# 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 COPY . . # Run tests and build. # RUN bun --bun run test # Uncomment when tests are ready. RUN bun --bun run build # 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 . # Run the app. USER bun EXPOSE 3000/tcp ENTRYPOINT [ "bun", "run", "start" ]