add docker files

This commit is contained in:
2026-02-28 06:23:26 +01:00
parent 2c81108b2b
commit f81ca17c9f
2 changed files with 77 additions and 0 deletions

33
Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
FROM oven/bun AS base
WORKDIR /app
# Install dependencies
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lock /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
RUN mkdir -p /temp/prod
COPY package.json bun.lock /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
# Build
FROM base AS build
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
ENV NODE_ENV=production
RUN bun run build
# Runtime
FROM base AS runtime
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=build /app/build build
COPY --from=build /app/package.json .
USER bun
ENV NODE_ENV=production
ENV PORT=3000
ENV HOST=0.0.0.0
EXPOSE 3000
CMD ["bun", "build/index.js"]