config pour génération d'image docker à la création de release

This commit is contained in:
2026-05-23 21:45:56 +02:00
parent 70ad0043a2
commit 9af9ddd8cb
4 changed files with 67 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
node_modules
dist
.git
.gitea
coverage
+37
View File
@@ -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
+13
View File
@@ -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
+12
View File
@@ -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;
}