This commit is contained in:
MaKarin
2026-04-03 22:15:10 -07:00
parent 8a578baac0
commit 5000e6baa0
6 changed files with 122 additions and 0 deletions

44
server/Dockerfile Normal file
View File

@@ -0,0 +1,44 @@
FROM node:20-bookworm-slim AS build
WORKDIR /app
ARG DATABASE_URL=postgresql://postgres:postgres@localhost:5432/toir
ENV DATABASE_URL=$DATABASE_URL
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssl \
&& rm -rf /var/lib/apt/lists/*
COPY package*.json ./
COPY prisma ./prisma
RUN npm ci
COPY nest-cli.json tsconfig*.json prisma.config.ts ./
COPY src ./src
RUN npx prisma generate
RUN npm run build
FROM node:20-bookworm-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /app/package*.json ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/prisma ./prisma
COPY --from=build /app/prisma.config.ts ./prisma.config.ts
COPY --from=build /app/dist ./dist
COPY docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod +x ./docker-entrypoint.sh
EXPOSE 3000
CMD ["./docker-entrypoint.sh"]