oc-p09-street-vision-poc/.github/workflows/cd.yml
Grégoire Mureau b154afcc7c Ajouter le CD P9 : build/push vers le registry OCI Forgejo.
Image PyTorch plus lourde que P7/P8 ; le job peut OOM sur DinD 8 Gio.
2026-09-09 21:10:09 +02:00

62 lines
1.8 KiB
YAML

# CD — build/push image vers le registry OCI Forgejo (OC-ADR-006).
# PyTorch 2.8 : plus lourd que P7/P8 (TF). DinD limité à 8 Gio — OOM possible.
name: CD
on:
push:
branches: [main]
paths:
- "Dockerfile"
- "app/**"
- "utils/**"
- "start.sh"
- "nginx.conf"
- "cityscapes_config.json"
- ".github/workflows/cd.yml"
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-and-push:
if: contains(github.server_url, 'gregoiremureau.com')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker CLI (client only) + daemon DinD
run: |
set -eu
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-27.5.1.tgz \
| tar -xz -C /tmp
install /tmp/docker/docker /usr/local/bin/docker
docker version
docker info
- name: Login registry Forgejo
run: |
set -eu
REGISTRY="${GITHUB_SERVER_URL#https://}"
echo "${{ secrets.PACKAGE_TOKEN }}" | docker login "${REGISTRY}" -u "${GITHUB_ACTOR}" --password-stdin
- name: Build and push
run: |
set -eu
REGISTRY="${GITHUB_SERVER_URL#https://}"
IMAGE="${REGISTRY}/grgmro/oc-p09-street-vision-poc"
SHORT_SHA="$(echo "${GITHUB_SHA}" | cut -c1-12)"
export DOCKER_BUILDKIT=0
docker build \
-t "${IMAGE}:${SHORT_SHA}" \
-t "${IMAGE}:latest" \
-f Dockerfile \
.
docker push "${IMAGE}:${SHORT_SHA}"
docker push "${IMAGE}:latest"
echo "pushed ${IMAGE}:${SHORT_SHA} and :latest"