30 lines
818 B
Docker
30 lines
818 B
Docker
# syntax=docker/dockerfile:1.4
|
|
FROM node:19-alpine AS deps
|
|
WORKDIR /leCoffre-front
|
|
|
|
COPY package.json ./
|
|
|
|
RUN apk update && apk add --no-cache openssh-client git
|
|
|
|
# Forward SSH agent via BuildKit (clé jamais écrite dans l'image)
|
|
RUN --mount=type=ssh \
|
|
mkdir -p /root/.ssh && \
|
|
ssh-keyscan git.4nkweb.com >> /root/.ssh/known_hosts && \
|
|
npm install --frozen-lockfile
|
|
|
|
# Configuration pour le développement
|
|
FROM node:19-alpine AS development
|
|
WORKDIR /leCoffre-front
|
|
|
|
COPY --from=deps /leCoffre-front/node_modules ./node_modules
|
|
COPY --from=deps /leCoffre-front/package.json ./package.json
|
|
COPY --from=deps /leCoffre-front/.env ./.env
|
|
COPY . .
|
|
|
|
# Création de l'utilisateur non-root
|
|
RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser .
|
|
|
|
USER lecoffreuser
|
|
|
|
CMD ["npm", "run", "dev"]
|
|
EXPOSE 3000 |