From d135917b2bbce3bd3e1e28c6e5382b7afa1abae3 Mon Sep 17 00:00:00 2001 From: Julien Denizot Date: Mon, 13 Apr 2026 19:08:45 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20ci:=20build=20sur=20amd64?= =?UTF-8?q?=20avec=20cache=20Docker,=20deploy=20s=C3=A9par=C3=A9=20sur=20P?= =?UTF-8?q?i?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build-deploy.yml | 25 +++++++++++++++++++------ Dockerfile | 6 ++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/build-deploy.yml b/.gitea/workflows/build-deploy.yml index 5cbbf94..f3cfe94 100644 --- a/.gitea/workflows/build-deploy.yml +++ b/.gitea/workflows/build-deploy.yml @@ -5,8 +5,8 @@ on: branches: [main] jobs: - build-deploy: - runs-on: [pi, arm64, deploy] + build: + runs-on: [public, build, docker, rust] steps: - name: Checkout uses: actions/checkout@v4 @@ -16,9 +16,11 @@ jobs: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.enuxia.fr \ -u luuna --password-stdin - - name: Build image + - name: Build image avec cache run: | - docker build \ + DOCKER_BUILDKIT=1 docker build \ + --cache-from git.enuxia.fr/enuxia-public/enuxia-quiz:latest \ + --build-arg BUILDKIT_INLINE_CACHE=1 \ --tag git.enuxia.fr/enuxia-public/enuxia-quiz:latest \ --tag git.enuxia.fr/enuxia-public/enuxia-quiz:${{ gitea.sha }} \ . @@ -28,12 +30,23 @@ jobs: docker push git.enuxia.fr/enuxia-public/enuxia-quiz:latest docker push git.enuxia.fr/enuxia-public/enuxia-quiz:${{ gitea.sha }} - - name: Deploy + - name: Cleanup build + if: always() + run: docker logout git.enuxia.fr + + deploy: + runs-on: [pi, arm64, deploy] + needs: build + steps: + - name: Deploy sur le Pi run: | + echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.enuxia.fr \ + -u luuna --password-stdin + docker pull git.enuxia.fr/enuxia-public/enuxia-quiz:latest docker compose -f /opt/enuxia-quiz/docker-compose.yml \ --env-file /opt/enuxia-quiz/.env \ up -d --force-recreate - - name: Cleanup + - name: Cleanup deploy if: always() run: docker logout git.enuxia.fr \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0e73d0d..3e0820d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ -# Build natif ARM64 +# ── Stage 1 : Builder ───────────────────────────────────────────────────────── FROM rust:slim AS builder +ARG BUILDKIT_INLINE_CACHE=1 + RUN apt-get update && apt-get install -y \ pkg-config libssl-dev curl git nodejs npm \ && rm -rf /var/lib/apt/lists/* @@ -17,7 +19,7 @@ ENV LEPTOS_TAILWIND_VERSION=v4.1.13 RUN cargo leptos build --release -# Runtime +# ── Stage 2 : Runtime ───────────────────────────────────────────────────────── FROM debian:bookworm-slim AS runtime RUN apt-get update && apt-get install -y \