Files
big-brother/Dockerfile
T
2026-10-12 14:25:22 +02:00

40 lines
1.1 KiB
Docker

# Big Brother: API AdonisJS + interface Angular dans une seule image.
# 1. Interface Angular
FROM node:24-alpine AS web
WORKDIR /web
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ ./
RUN npx ng build
# 2. API AdonisJS (compilée dans /api/build)
FROM node:24-alpine AS api
RUN apk add --no-cache python3 make g++
WORKDIR /api
COPY api/package.json api/package-lock.json ./
RUN npm ci
COPY api/ ./
RUN node ace build
# 3. Image finale
FROM node:24-alpine
# git (mises à jour des projets), client Docker + compose (actions sur les
# conteneurs), tar (sauvegardes), tzdata (fuseau horaire de TZ)
RUN apk add --no-cache git docker-cli docker-cli-compose tar tzdata \
&& git config --system --add safe.directory '*'
WORKDIR /app
COPY --from=api /api/build ./
RUN apk add --no-cache --virtual .build python3 make g++ \
&& npm ci --omit=dev \
&& apk del .build
COPY --from=web /web/dist/web/browser ./public
ENV NODE_ENV=production
EXPOSE 3333
# Les migrations SQLite passent à chaque démarrage (rien à faire si la base est à jour).
CMD ["sh", "-c", "node ace migration:run --force && node bin/server.js"]