This commit is contained in:
@@ -17,7 +17,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.TOKEN }}" | docker login git.home.arrondeau.fr -u ${{ gitea.actor }} --password-stdin
|
echo "${{ secrets.TOKEN }}" | docker login git.home.arrondeau.fr -u ${{ gitea.actor }} --password-stdin
|
||||||
|
|
||||||
- name: Build and Push Docker Image
|
- name: Build and Push Docker Images
|
||||||
run: |
|
run: |
|
||||||
|
# Build and Push FRONT
|
||||||
docker build -t git.home.arrondeau.fr/${{ gitea.repository }}:latest .
|
docker build -t git.home.arrondeau.fr/${{ gitea.repository }}:latest .
|
||||||
docker push git.home.arrondeau.fr/${{ gitea.repository }}:latest
|
docker push git.home.arrondeau.fr/${{ gitea.repository }}:latest
|
||||||
|
|
||||||
|
# Build and Push ADMIN
|
||||||
|
docker build -t git.home.arrondeau.fr/${{ gitea.repository }}-admin:latest ./admin
|
||||||
|
docker push git.home.arrondeau.fr/${{ gitea.repository }}-admin:latest
|
||||||
41
Dockerfile
41
Dockerfile
@@ -1,14 +1,43 @@
|
|||||||
FROM node:20-alpine
|
# Étape 1 : Installation des dépendances
|
||||||
|
FROM node:20-alpine AS deps
|
||||||
RUN apk add --no-cache libc6-compat openssl
|
RUN apk add --no-cache libc6-compat openssl
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# On copie tout, on installe tout, on build tout au même endroit
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# Étape 2 : Build de l'application
|
||||||
|
FROM node:20-alpine AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm install
|
|
||||||
|
# Variables d'environnement nécessaires pour le build
|
||||||
|
# (Prisma a besoin de DATABASE_URL pour npx prisma generate)
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
RUN npx prisma generate
|
RUN npx prisma generate
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
EXPOSE 3000
|
# Étape 3 : Image de production (Runner)
|
||||||
|
FROM node:20-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
# On lance directement via npm
|
ENV NODE_ENV production
|
||||||
CMD ["npm", "start"]
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
|
# On ne copie que le nécessaire du build standalone
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
|
USER nextjs
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
ENV PORT 3000
|
||||||
|
ENV HOSTNAME "0.0.0.0"
|
||||||
|
|
||||||
|
CMD ["node", "server.js"]
|
||||||
@@ -20,6 +20,7 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
app:
|
app:
|
||||||
|
image: git.home.arrondeau.fr/streaper2/afrov2:latest
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
@@ -35,6 +36,7 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
admin:
|
admin:
|
||||||
|
image: git.home.arrondeau.fr/streaper2/afrov2-admin:latest
|
||||||
build:
|
build:
|
||||||
context: ./admin
|
context: ./admin
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|||||||
Reference in New Issue
Block a user