v0.0.11 #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file builds the Docker image and pushes it to ghcr.io | |
# It is triggered on every release | |
# The build will run for multiple platforms (amd64, arm64, armv7) | |
# The build will run on multiple LTS versions of Django (3.2, 4.2) | |
# The build will run on multiple versions of Python (3.8, 3.9, 3.10), which will be configured in the matrix and pinned to the LTS versions of Django | |
name: Build Image | |
on: | |
release: | |
types: [published] | |
jobs: | |
build-matrix: | |
strategy: | |
fail-fast: false | |
matrix: | |
software-versions: [ | |
{"python-version": 3.9, "django-version": 3.2, "debian-version": "bullseye"}, | |
{"python-version": 3.11, "django-version": 4.2, "debian-version": "bookworm"} | |
] | |
platform: [amd64] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Copy from django${{ matrix.software-versions.django-version }} directory to root | |
run: cp -r django${{ matrix.software-versions.django-version }}/* . | |
- name: Replace Python Version in Dockerfile | |
run: sed -i "s/PYTHON_VERSION/${{ matrix.software-versions.python-version }}/g" Dockerfile | |
- name: Replace Debian Version in Dockerfile | |
run: sed -i "s/DEBIAN_VERSION/${{ matrix.software-versions.debian-version }}/g" Dockerfile | |
- name: Replace the Django Version in Dockerfile | |
run: sed -i "s/DJANGO_VERSION/${{ matrix.software-versions.django-version }}/g" Dockerfile | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build the image | |
run: docker buildx build --platform linux/${{ matrix.platform }} --push -t ghcr.io/visdesignlab/django-image:${{matrix.software-versions.django-version}}-${{ github.ref_name }} . |