8 changed files with 2976 additions and 79 deletions
@ -1,35 +1,15 @@
@@ -1,35 +1,15 @@
|
||||
# Dockerfile for production deployments of Alexandria. |
||||
# Based on the Bun Docker guide: https://bun.sh/guides/ecosystem/docker. |
||||
|
||||
# Use the official Bun image |
||||
FROM oven/bun:1.2-alpine AS base |
||||
WORKDIR /usr/src/app |
||||
|
||||
# Install dependencies into a temp directory. |
||||
# This will cache them and speed up future builds. |
||||
FROM base AS install |
||||
RUN mkdir -p /temp/dev |
||||
COPY package.json /temp/dev/ |
||||
RUN cd /temp/dev && bun install |
||||
|
||||
# Copy node_modules from temp directory. |
||||
# Then copy all (non-ignored) project files into the image. |
||||
FROM base AS prerelease |
||||
ENV NODE_ENV=production |
||||
COPY --from=install /temp/dev/node_modules node_modules |
||||
FROM denoland/deno:alpine AS build |
||||
WORKDIR /app/src |
||||
COPY . . |
||||
RUN deno install |
||||
RUN deno task build |
||||
|
||||
# Run tests and build. |
||||
# RUN bun --bun run test # Uncomment when tests are ready. |
||||
RUN bun --bun run build |
||||
FROM denoland/deno:alpine AS release |
||||
WORKDIR /app |
||||
COPY --from=build /app/src/build/ ./build/ |
||||
COPY --from=build /app/src/import_map.json . |
||||
|
||||
# Copy production dependencies and source code into final image. |
||||
FROM base AS release |
||||
ENV HOST=0.0.0.0 |
||||
ENV ORIGIN=http://localhost:3040 |
||||
COPY --from=prerelease /usr/src/app/build . |
||||
ENV ORIGIN=http://localhost:3000 |
||||
|
||||
# Run the app. |
||||
USER bun |
||||
EXPOSE 3000/tcp |
||||
ENTRYPOINT [ "bun", "run", "start" ] |
||||
EXPOSE 3000 |
||||
CMD [ "deno", "run", "--allow-env", "--allow-read", "--allow-net", "--import-map=import_map.json", "./build/index.js" ] |
||||
|
||||
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
FROM denoland/deno:alpine AS build |
||||
WORKDIR /app/src |
||||
COPY . . |
||||
RUN deno install |
||||
RUN deno task build |
||||
|
||||
FROM denoland/deno:alpine AS release |
||||
WORKDIR /app |
||||
COPY --from=build /app/src/build/ ./build/ |
||||
COPY --from=build /app/src/import_map.json . |
||||
|
||||
ENV ORIGIN=https://next-alexandria.gitcitadel.eu |
||||
|
||||
EXPOSE 3000 |
||||
CMD [ "deno", "run", "--allow-env", "--allow-read", "--allow-net", "--import-map=import_map.json", "./build/index.js" ] |
||||
@ -1,43 +1,15 @@
@@ -1,43 +1,15 @@
|
||||
# Dockerfile for production deployments of Alexandria. |
||||
# Based on the Bun Docker guide: https://bun.sh/guides/ecosystem/docker. |
||||
|
||||
# Use the official Bun image |
||||
FROM oven/bun:1 AS base |
||||
WORKDIR /usr/src/app |
||||
|
||||
# Install dependencies into temp directory. |
||||
# This will cache them and speed up future builds. |
||||
FROM base AS install |
||||
RUN mkdir -p /temp/dev |
||||
COPY package.json bun.lock /temp/dev/ |
||||
RUN cd /temp/dev && bun install --frozen-lockfile |
||||
|
||||
# Install with --production (exclude devDependencies) |
||||
RUN mkdir -p /temp/prod |
||||
COPY package.json bun.lock /temp/prod/ |
||||
RUN cd /temp/prod && bun install --frozen-lockfile --production |
||||
|
||||
# Copy node_modules from temp directory. |
||||
# Then copy all (non-ignored) project files into the image. |
||||
FROM base AS prerelease |
||||
COPY --from=install /temp/dev/node_modules node_modules |
||||
FROM denoland/deno:alpine AS build |
||||
WORKDIR /app/src |
||||
COPY . . |
||||
RUN deno install |
||||
RUN deno task build |
||||
|
||||
# [Optional] Tests & build. |
||||
ENV NODE_ENV=production |
||||
ENV ALEX_HOST=127.0.0.1 |
||||
ENV ALEX_PORT=3040 |
||||
ENV ALEX_ORIGIN=https://alexandria.gitcitadel.eu |
||||
RUN bun test |
||||
RUN bun run build |
||||
FROM denoland/deno:alpine AS release |
||||
WORKDIR /app |
||||
COPY --from=build /app/src/build/ ./build/ |
||||
COPY --from=build /app/src/import_map.json . |
||||
|
||||
# Copy production dependencies and source code into final image. |
||||
FROM base AS release |
||||
COPY --from=install /temp/prod/node_modules node_modules |
||||
COPY --from=prerelease /usr/src/app/index.ts . |
||||
COPY --from=prerelease /usr/src/app/package.json . |
||||
ENV ORIGIN=https://alexandria.gitcitadel.eu |
||||
|
||||
# Run the app. |
||||
USER bun |
||||
EXPOSE 3040/tcp |
||||
ENTRYPOINT [ "bun", "run", "index.ts" ] |
||||
EXPOSE 3000 |
||||
CMD [ "deno", "run", "--allow-env", "--allow-read", "--allow-net", "--import-map=import_map.json", "./build/index.js" ] |
||||
|
||||
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
{ |
||||
"importMap": "./import_map.json", |
||||
"compilerOptions": { |
||||
"allowJs": true, |
||||
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"] |
||||
} |
||||
} |
||||
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
{ |
||||
"imports": { |
||||
"he": "npm:he@1.2.x", |
||||
"@nostr-dev-kit/ndk": "npm:@nostr-dev-kit/ndk@2.11.x", |
||||
"@nostr-dev-kit/ndk-cache-dexie": "npm:@nostr-dev-kit/ndk-cache-dexie@2.5.x", |
||||
"@popperjs/core": "npm:@popperjs/core@2.11.x", |
||||
"@tailwindcss/forms": "npm:@tailwindcss/forms@0.5.x", |
||||
"@tailwindcss/typography": "npm:@tailwindcss/typography@0.5.x", |
||||
"asciidoctor": "npm:asciidoctor@3.0.x", |
||||
"d3": "npm:d3@7.9.x", |
||||
"nostr-tools": "npm:nostr-tools@2.10.x", |
||||
"tailwind-merge": "npm:tailwind-merge@2.5.x", |
||||
"svelte": "npm:svelte@5.0.x", |
||||
"flowbite": "npm:flowbite@2.2.x", |
||||
"flowbite-svelte": "npm:flowbite-svelte@0.44.x", |
||||
"flowbite-svelte-icons": "npm:flowbite-svelte-icons@2.0.x" |
||||
} |
||||
} |
||||
Loading…
Reference in new issue