Skip to content

Update dakara-server.Dockerfile #155

Update dakara-server.Dockerfile

Update dakara-server.Dockerfile #155

Workflow file for this run

name: CI
on:
push:
branches: ["main", "renovate/*"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
id-token: write
env:
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- owner: DakaraProject
repo: dakara-client-web
branch: master
ref: 2562635c030cd8cd5cd0fbbf4dab0ea137b1de96
plateforms: linux/amd64,linux/arm64
- owner: DakaraProject
repo: dakara-server
branch: master
ref: e832e3cd90d71ed1a0c85478517cdce300c6ee45
plateforms: linux/amd64,linux/arm64
env:
REPOSITORY: ${{ matrix.owner }}/${{ matrix.repo }}
IMAGE_NAME: ${{ github.repository_owner }}/${{ matrix.repo }}
steps:
- name: Checkout project repository
uses: actions/checkout@v4
with:
repository: ${{ env.REPOSITORY }}
ref: ${{ matrix.ref }}
- name: Checkout containers repository
uses: actions/checkout@v4
with:
path: containers
- name: Apply .diff and set Dockerfile
id: prepare
run: |
DIFF="containers/${{ matrix.repo }}.diff"
if [ -f $DIFF ]; then
echo Applying $DIFF
git apply $DIFF
fi
CUSTOM_DOCKERFILE="containers/${{ matrix.repo }}.Dockerfile"
if [ -f "$CUSTOM_DOCKERFILE" ]; then
DOCKERFILE=$CUSTOM_DOCKERFILE
elif [ -n "${{ matrix.dockerfile }}" ]; then
DOCKERFILE=${{ matrix.dockerfile }}
else
DOCKERFILE=Dockerfile
fi
echo Will use $DOCKERFILE
echo DOCKERFILE=$DOCKERFILE >> $GITHUB_OUTPUT
- name: Install cosign
if: github.ref == 'refs/heads/main'
uses: sigstore/cosign-installer@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ matrix.branch }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ steps.prepare.outputs.DOCKERFILE }}
platforms: ${{ matrix.plateforms }}
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Sign the published Docker image
if: github.ref == 'refs/heads/main'
env:
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}