From 9af9ddd8cb6ff0d53f3efb8f5ea439eea0cd39e2 Mon Sep 17 00:00:00 2001 From: Gato Date: Sat, 23 May 2026 21:45:56 +0200 Subject: [PATCH] =?UTF-8?q?config=20pour=20g=C3=A9n=C3=A9ration=20d'image?= =?UTF-8?q?=20docker=20=C3=A0=20la=20cr=C3=A9ation=20de=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 5 +++++ .gitea/workflows/release.yml | 37 ++++++++++++++++++++++++++++++++++++ Dockerfile | 13 +++++++++++++ nginx.conf | 12 ++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitea/workflows/release.yml create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0a8348e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +dist +.git +.gitea +coverage diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..01f2a84 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release + +on: + release: + types: [published] + +jobs: + docker: + name: Build & push Docker image + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: https://github.com/actions/checkout@v4 + + - name: Extract registry host from server URL + id: registry + run: | + HOST=$(echo '${{ gitea.server_url }}' | sed 's|https://||' | sed 's|http://||') + echo "host=${HOST}" >> $GITHUB_OUTPUT + echo "image=${HOST}/${{ gitea.repository }}" >> $GITHUB_OUTPUT + + - name: Login to Gitea container registry + uses: https://github.com/docker/login-action@v3 + with: + registry: ${{ steps.registry.outputs.host }} + username: ${{ gitea.actor }} + password: ${{ secrets.RELEASE_TOKEN }} + + - name: Build and push + uses: https://github.com/docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ${{ steps.registry.outputs.image }}:${{ gitea.ref_name }} + ${{ steps.registry.outputs.image }}:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0066358 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +# Stage 1 — Build Angular +FROM node:22-alpine AS builder +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build + +# Stage 2 — Serve with nginx +FROM nginx:alpine +COPY --from=builder /app/dist/Bonsai-webapp/browser /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..5db99a0 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,12 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + gzip on; + gzip_types text/plain text/css application/javascript application/json image/svg+xml; +}