Update Dockerfile to use dev mode
This commit is contained in:
parent
a351c1814c
commit
63fc45927f
25
Dockerfile
25
Dockerfile
@ -15,34 +15,19 @@ RUN --mount=type=ssh \
|
|||||||
ssh-keyscan git.4nkweb.com >> /root/.ssh/known_hosts && \
|
ssh-keyscan git.4nkweb.com >> /root/.ssh/known_hosts && \
|
||||||
npm install --frozen-lockfile
|
npm install --frozen-lockfile
|
||||||
|
|
||||||
# Rebuild the source code only when needed
|
# Configuration pour le développement
|
||||||
FROM node:19-alpine AS builder
|
FROM node:19-alpine AS development
|
||||||
WORKDIR /leCoffre-front
|
WORKDIR /leCoffre-front
|
||||||
|
|
||||||
COPY --from=deps /leCoffre-front/node_modules ./node_modules
|
COPY --from=deps /leCoffre-front/node_modules ./node_modules
|
||||||
COPY --from=deps /leCoffre-front/package.json ./package.json
|
COPY --from=deps /leCoffre-front/package.json ./package.json
|
||||||
COPY --from=deps /leCoffre-front/.env ./.env
|
COPY --from=deps /leCoffre-front/.env ./.env
|
||||||
COPY tsconfig.json tsconfig.json
|
COPY . .
|
||||||
COPY next.config.js next.config.js
|
|
||||||
COPY src src
|
|
||||||
|
|
||||||
RUN npm run build
|
# Création de l'utilisateur non-root
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
|
||||||
FROM node:19-alpine AS production
|
|
||||||
WORKDIR /leCoffre-front
|
|
||||||
|
|
||||||
# Création de l’utilisateur non-root
|
|
||||||
RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser .
|
RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser .
|
||||||
|
|
||||||
COPY public ./public
|
|
||||||
COPY --from=builder --chown=lecoffreuser /leCoffre-front/node_modules ./node_modules
|
|
||||||
COPY --from=builder --chown=lecoffreuser /leCoffre-front/.next ./.next
|
|
||||||
COPY --from=builder --chown=lecoffreuser /leCoffre-front/next.config.js ./next.config.js
|
|
||||||
COPY --from=builder --chown=lecoffreuser /leCoffre-front/package.json ./package.json
|
|
||||||
COPY --from=builder --chown=lecoffreuser /leCoffre-front/.env ./.env
|
|
||||||
|
|
||||||
USER lecoffreuser
|
USER lecoffreuser
|
||||||
|
|
||||||
CMD ["npm", "run", "start"]
|
CMD ["npm", "run", "dev"]
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
Loading…
x
Reference in New Issue
Block a user