docker: image for the Oracle server, Trivy gate, and a release workflow
CI / Trivy (dependências e segredos) (push) Successful in 42s
CI / Lint, design e build (push) Canceled after 2m18s
CI / Imagem Docker (push) Canceled after 1m34s
CI / Trivy (dependências e segredos) (push) Successful in 36s
CI / Lint, design e build (push) Successful in 2m59s
CI / Imagem Docker (push) Successful in 2m59s
Release / ci (push) Successful in 3m37s
Release / Publica a imagem (linux/arm64) (push) Successful in 4m21s

Next standalone build in three stages, non-root, healthchecked. next 15.5.28
(image-optimiser RCE) with postcss pinned past the copy bundled by next.
release.yml publishes linux/arm64 to the Gitea registry. The book/ directory is
a repository of its own and stays out of the build context.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Sonnet 5.5 committed 2026-10-30 11:20:05 -03:00
1 parent aa636c83b1
commit fd45d80287
7 files changed
+419 -323

No files matched your search

+45
View File
@@ -4,6 +4,8 @@ on:
pull_request:
push:
branches: [main]
# O release.yml roda esta mesma suíte antes de publicar a imagem.
workflow_call:
permissions:
contents: read
@@ -46,3 +48,46 @@ jobs:
- run: npm run check
- run: npm run build
# Trivy roda pela imagem oficial: o trivy-action clona o repositório do Trivy
# do mesmo servidor do workflow, que aqui é o Gitea, e não o GitHub.
# O workspace do job é um volume que o daemon não enxerga, então os arquivos
# entram no container com `docker cp` em vez de `-v`.
seguranca:
name: Trivy (dependências e segredos)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Repositório
run: |
cid=$(docker create --network host -v trivy-cache:/root/.cache/ -w /src aquasec/trivy:0.70.0 \
fs --scanners vuln,secret,misconfig --severity HIGH,CRITICAL --exit-code 1 .)
docker cp . "$cid:/src"
docker start -a "$cid"
status=$(docker inspect -f '{{.State.ExitCode}}' "$cid")
docker rm "$cid" >/dev/null
exit "$status"
imagem:
name: Imagem Docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# `docker build` simples: o cache de camadas fica no volume persistente do
# daemon do runner, e o buildx criaria um BuildKit novo a cada job.
- name: Build
run: docker build -t espdocs:ci .
- name: Trivy na imagem
run: |
docker run --rm --network host -v trivy-cache:/root/.cache/ -e DOCKER_HOST=tcp://127.0.0.1:2375 aquasec/trivy:0.70.0 \
image --severity HIGH,CRITICAL --exit-code 1 espdocs:ci
- name: A imagem sobe e responde
run: |
docker run -d --name espdocs-ci --network host -e PORT=3999 espdocs:ci
for i in $(seq 1 30); do
curl -fsS http://127.0.0.1:3999/ >/dev/null && ok=1 && break
sleep 2
done
docker logs espdocs-ci | tail -5
docker rm -f espdocs-ci >/dev/null
test "${ok:-0}" = 1
+67
View File
@@ -0,0 +1,67 @@
name: Release
# Publica a imagem no registro de containers do Gitea depois de um merge em main,
# e de novo com tag semver quando uma tag v* é enviada. O servidor só faz pull.
# Precisa do secret de usuário REGISTRY_TOKEN (token do Gitea com write:package).
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
concurrency:
group: release
cancel-in-progress: false
env:
REGISTRY: git.lucasrguerra.dev.br
jobs:
# Nada é publicado sem a suíte completa passar antes.
ci:
uses: ./.gitea/workflows/ci.yml
publicar:
name: Publica a imagem (linux/arm64)
needs: ci
# O único runner é arm64 e o servidor de destino (Oracle) também, então a
# imagem é construída nativamente, sem emulação.
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- id: nome
run: |
repo='${{ gitea.repository }}'
echo "image=${{ env.REGISTRY }}/${repo,,}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v4
- name: Autentica no registro
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Metadados
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ steps.nome.outputs.image }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
type=sha,format=long
- name: Build e push
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ steps.nome.outputs.image }}:buildcache
cache-to: type=registry,ref=${{ steps.nome.outputs.image }}:buildcache,mode=max