You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
672 B
Docker
33 lines
672 B
Docker
FROM node:18-alpine AS builder
|
|
|
|
WORKDIR "/app"
|
|
|
|
COPY . .
|
|
|
|
RUN npm ci
|
|
|
|
RUN npm run build
|
|
|
|
RUN npm prune --production
|
|
|
|
FROM node:18-alpine AS prod
|
|
|
|
WORKDIR "/app"
|
|
|
|
COPY --from=builder /app/package.json ./package.json
|
|
COPY --from=builder /app/package-lock.json ./package-lock.json
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
|
|
ENV DB_HOST
|
|
ENV DB_PORT
|
|
ENV DB_USER
|
|
ENV DB_PASS
|
|
ENV DB_NAME
|
|
ENV JWT_SECRET
|
|
ENV JWT_EXPIRY
|
|
|
|
CMD ["sh", "-c", "DB_HOST=${DB_HOST} DB_PORT=${DB_PORT} DB_USER=${DB_USER} DB_PASS=${DB_PASS} DB_NAME=${DB_NAME} JWT_SECRET=${JWT_SECRET} JWT_EXPIRY=${JWT_EXPIRY} npm run start:prod --host 0.0.0.0"]
|
|
|
|
EXPOSE 3000
|