diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 519b15d..436258e 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -65,7 +65,12 @@ jobs: - name: Build if: ${{ steps.plano.outputs.reuse != 'true' }} - run: docker build --target runtime --build-arg VERSION="${{ gitea.ref_name }}" --build-arg REVISION="${{ gitea.sha }}" -t inbraille:ci . + # O rótulo de versão vem do CHANGELOG (primeira versão numerada), não do nome da + # branch: a mesma imagem é reaproveitada pela tag, então o rótulo precisa valer para ela. + run: | + version=$(grep -m1 -oE '^## \[[0-9]+\.[0-9]+\.[0-9]+\]' CHANGELOG.md | tr -d '#[] ') + echo "versão da imagem: $version" + docker build --target runtime --build-arg VERSION="$version" --build-arg REVISION="${{ gitea.sha }}" -t inbraille:ci . - name: Trivy na imagem if: ${{ steps.plano.outputs.reuse != 'true' }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d9975c..a19d02f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,15 @@ Everything notable in InBraille is recorded here. The format follows ## [Unreleased] +## [1.3.3] - 2026-11-02 + +### Changed + +- The image now ships `curl`, so the Coolify healthcheck (which runs `curl` inside the container) + works; it is enabled on `/`. The image `HEALTHCHECK` still uses Python. +- The `org.opencontainers.image.version` label comes from the first numbered CHANGELOG entry + instead of the branch name (it said `main` on the 1.3.2 image). + ## [1.3.2] - 2026-11-02 ### Changed @@ -61,7 +70,8 @@ sources of the live plate preview (`public/preview.js`) and of the browser-side - Security hardening of the API and the container (see SECURITY.md). - Dependencies upgraded; all Trivy findings (critical, high and medium) resolved. -[Unreleased]: https://git.lucasrguerra.dev.br/lucasrguerra/inbraille/compare/v1.3.2...HEAD +[Unreleased]: https://git.lucasrguerra.dev.br/lucasrguerra/inbraille/compare/v1.3.3...HEAD +[1.3.3]: https://git.lucasrguerra.dev.br/lucasrguerra/inbraille/compare/v1.3.2...v1.3.3 [1.3.2]: https://git.lucasrguerra.dev.br/lucasrguerra/inbraille/compare/v1.3.1...v1.3.2 [1.3.1]: https://git.lucasrguerra.dev.br/lucasrguerra/inbraille/releases/tag/v1.3.1 [1.1.0]: https://git.lucasrguerra.dev.br/lucasrguerra/inbraille/releases/tag/v1.1.0 diff --git a/Dockerfile b/Dockerfile index aaaff23..a88cb38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,10 @@ LABEL org.opencontainers.image.title="InBraille" \ org.opencontainers.image.version="${VERSION}" \ org.opencontainers.image.revision="${REVISION}" +# curl: the Coolify healthcheck runs `curl` inside the container (the image HEALTHCHECK uses Python). +RUN apt-get update && apt-get install -y --no-install-recommends curl \ + && rm -rf /var/lib/apt/lists/* + COPY requirements.txt . # pip/setuptools (and the libraries vendored inside pip) are build tools: remove them from the runtime image. RUN pip install --prefer-binary -r requirements.txt \ diff --git a/scripts/smoke-imagem.sh b/scripts/smoke-imagem.sh index 533e2c2..ffc8853 100755 --- a/scripts/smoke-imagem.sh +++ b/scripts/smoke-imagem.sh @@ -69,6 +69,13 @@ grep -qi '^x-content-type-options: nosniff' <<< "$head" || falhou "/: sem X-Cont grep -qi '^x-frame-options: DENY' <<< "$head" || falhou "/: sem X-Frame-Options" grep -qi '^cache-control: .*no-cache' <<< "$head" || falhou "/: sem Cache-Control no-cache (as páginas precisam revalidar)" +# O healthcheck do Coolify roda `curl` dentro do contêiner: ele precisa existir e funcionar. +docker exec "$app" curl -fsS -o /dev/null http://127.0.0.1:3000/ || falhou "o curl dentro da imagem não alcança a aplicação (healthcheck do Coolify)" + +# O rótulo de versão da imagem é um número (não o nome de uma branch). +versao=$(docker inspect -f '{{index .Config.Labels "org.opencontainers.image.version"}}' "$imagem") +[[ "$versao" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || falhou "rótulo de versão inválido: '$versao'" + # Roda sem privilégios. [ "$(docker exec "$app" id -u)" = 10001 ] || falhou "o processo não roda como o usuário 10001"