lecoffre-front/Dockerfiles/Dockerfile.front
hugolxt 910a5820b0
🚧 Init front repo lecoffre (#1)
Initialization of the front repository
2023-03-15 14:38:50 +01:00

35 lines
1023 B
Docker

# Install dependencies only when needed
FROM node:19-alpine AS deps
WORKDIR lecoffre-front
COPY package.json ./
RUN npm install --frozen-lockfile
# Rebuild the source code only when needed
FROM node:19-alpine AS builder
WORKDIR lecoffre-front
COPY . .
COPY --from=deps lecoffre-front/node_modules ./node_modules
RUN npm run build
# Production image, copy all the files and run next
FROM node:19-alpine AS production
WORKDIR lecoffre-front
RUN adduser -D lecoffre-frontuser --uid 10000 && chown -R lecoffre-frontuser .
COPY --from=builder --chown=lecoffre-frontuser lecoffre-front/node_modules ./node_modules
COPY --from=builder --chown=lecoffre-frontuser lecoffre-front/public ./public
COPY --from=builder --chown=lecoffre-frontuser lecoffre-front/.next ./.next
COPY --from=builder --chown=lecoffre-frontuser lecoffre-front/next.config.js ./next.config.js
COPY --from=builder --chown=lecoffre-frontuser lecoffre-front/package.json ./package.json
USER lecoffre-frontuser
CMD ["npm", "run", "start"]
EXPOSE 3000