add infra
This commit is contained in:
44
server/Dockerfile
Normal file
44
server/Dockerfile
Normal 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"]
|
||||
Reference in New Issue
Block a user