Skip to content

Remove obsolete version in compose file. #432

Remove obsolete version in compose file.

Remove obsolete version in compose file. #432

Workflow file for this run

name: Docker build
on:
- push
concurrency:
group: docker-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Poetry
uses: ThePalaceProject/circulation/.github/actions/poetry@main
with:
version: "1.7.1"
- name: Setup Dunamai
run: |
poetry install --only ci
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Create version file
run: |
echo "__version__ = '$(dunamai from git --style semver)'" >> virtual_library_card/_version.py
echo "__commit__ = '$(dunamai from git --format {commit} --full-commit)'" >> virtual_library_card/_version.py
echo "__branch__ = '$(dunamai from git --format {branch})'" >> virtual_library_card/_version.py
# See comment here: https://github.com/actions/runner-images/issues/1187#issuecomment-686735760
- name: Disable network offload
run: sudo ethtool -K eth0 tx off rx off
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate tags
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/virtual-library-card
tags: |
type=raw,value=latest,enable=${{ github.ref_name == 'main' }},priority=10
type=semver,pattern={{major}}.{{minor}},priority=10
type=semver,pattern={{version}},priority=20
type=ref,event=branch,priority=30
type=sha,priority=40
# We use docker/metadata-action to generate tags, instead of using string
# interpolation, because it properly handles making sure special
# characters are escaped, and the repo owner string is lowercase.
- name: Generate tags for cache image
id: cache-meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/virtual-library-card
tags: |
type=raw,value=latest
if: github.ref_type == 'branch' && github.ref_name != 'main'
- name: Build image (with cache)
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64
cache-from: type=registry,ref=${{ fromJSON(steps.cache-meta.outputs.json).tags[0] }}
if: github.ref_type == 'branch' && github.ref_name != 'main'
- name: Build image (full)
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64
cache-to: type=inline
if: github.ref_type == 'tag' || github.ref_name == 'main'