egoport/Dockerfile

28 lines
717 B
Docker
Raw Normal View History

2023-11-20 19:32:02 +01:00
FROM node:lts-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile
FROM node:lts-alpine AS builder
# ARG APP_ENV
2023-11-20 19:32:02 +01:00
WORKDIR /app
COPY . .
COPY .env .env
2023-11-20 19:32:02 +01:00
COPY --from=deps /app/node_modules ./node_modules
RUN npm run build
FROM node:lts-alpine AS runner
WORKDIR /usr/app
ARG APP_ENV
COPY --from=builder /app/build ./build
COPY package.json ./
COPY .env .env
2023-11-20 19:32:02 +01:00
RUN npm install -g pnpm
RUN pnpm install --prod
USER node
ENV NODE_ENV="production"
CMD ["npm", "start"]