mirror of
https://github.com/suitenumerique/messages.git
synced 2026-09-10 03:47:45 +02:00
* (ops) implement production docker images
Github workflows:
- moved docker-publish jobs into a separate file on push main only
Backend:
- added healthcheck on backend Dockerfile + minor fixes
- bumped django to 5.1.15 to mitigate major CVE
- moved /healthz endpoint to /__heartbeat__ + added db connection
check
Frontend:
- Added runtime-prod Dockerfile target + minor fixes on the Dockerfile
- bump next to 15.5.9 to mitigate major CVE
- moved nginx config to standard nginx container configuration
template, fixed `scalingo_postfrontend` accordingly
Keycloak:
- Added production Dockerfile
- Removed scalingo_pgdump script & cron.json
socks-proxy:
- added package upgrades run into runtime Dockerfile stage
Misc:
- removed scalingo_pgdump.sh & cron.json
- fixed compose and e2e nginx configs with /healthz replacement
* (fix) coderabbit recommandations
81 lines
2.8 KiB
YAML
81 lines
2.8 KiB
YAML
name: Build and Push Container Image
|
|
|
|
"on":
|
|
workflow_call:
|
|
inputs:
|
|
registry:
|
|
type: string
|
|
required: false
|
|
default: ghcr.io
|
|
description: The container registry FQDN.
|
|
image_name:
|
|
type: string
|
|
required: true
|
|
description: The suffix for the image name, without the registry and without the repository path.
|
|
context:
|
|
type: string
|
|
required: true
|
|
description: The path to the context to start `docker build` into.
|
|
target:
|
|
type: string
|
|
required: false
|
|
default: ""
|
|
description: The Dockerfile target stage to build the image for.
|
|
|
|
# see https://docs.github.com/en/enterprise-cloud@latest/actions/how-tos/use-cases-and-examples/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
|
|
jobs:
|
|
docker-build-push:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
attestations: write
|
|
id-token: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ inputs.registry }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ inputs.registry }}/${{ github.repository }}-${{ inputs.image_name }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
- name: Build and push Docker image
|
|
id: push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ${{ inputs.context }}
|
|
target: ${{ inputs.target }}
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
- name: Generate artifact attestation
|
|
uses: actions/attest-build-provenance@v2
|
|
with:
|
|
subject-name: ${{ inputs.registry }}/${{ github.repository }}-${{ inputs.image_name }}
|
|
subject-digest: ${{ steps.push.outputs.digest }}
|
|
push-to-registry: true
|
|
- name: Delete all untagged container images
|
|
uses: actions/delete-package-versions@v5
|
|
with:
|
|
package-name: messages-${{ inputs.image_name }}
|
|
package-type: 'container'
|
|
min-versions-to-keep: 0
|
|
delete-only-untagged-versions: true
|
|
- name: Container images retention
|
|
uses: actions/delete-package-versions@v5
|
|
with:
|
|
package-name: messages-${{ inputs.image_name }}
|
|
package-type: 'container'
|
|
min-versions-to-keep: 30
|
|
ignore-versions: '^(latest|main|\\d+\\.\\d+(\\.\\d+)?)$'
|