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.

45 lines
864 B
Docker

FROM node:18-alpine AS pnpm
RUN npm i -g pnpm
FROM pnpm AS depends
WORKDIR "/app"
COPY package.json pnpm-lock.yaml .
RUN pnpm install
FROM pnpm AS builder
2 years ago
WORKDIR "/app"
COPY . .
COPY --from=depends /app/node_modules ./node_modules
2 years ago
RUN pnpm build
RUN pnpm prune --prod
2 years ago
FROM node:18-alpine AS prod
2 years ago
WORKDIR "/app"
#COPY --from=builder /app/package.json ./package.json
#COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
2 years ago
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
2 years ago
ENV DB_HOST db
ENV DB_PORT 3306
ENV DB_USER root
ENV DB_PASS secret
ENV DB_NAME mx
ENV JWT_SECRET secret
ENV JWT_EXPIRY 1h
2 years ago
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} node dist/main.js --host 0.0.0.0"]
2 years ago
EXPOSE 3000