Add Docker build test to CI workflow
- Adds docker-build-test job to regression.yml - Runs on push/merge to master and release branches - Extracts VERSION_TAG from pyproject.toml for build - Tests that Docker image builds and runs successfully - Resolves dockerfile syntax warnings - Resolves #2196"
This commit is contained in:
parent
1d2c4b134f
commit
b99719ce60
|
|
@ -11,6 +11,7 @@ on:
|
||||||
- '**/*.py'
|
- '**/*.py'
|
||||||
- '**/*.ini'
|
- '**/*.ini'
|
||||||
- '**/*.toml'
|
- '**/*.toml'
|
||||||
|
- 'Dockerfile'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
@ -21,11 +22,13 @@ on:
|
||||||
- '**/*.py'
|
- '**/*.py'
|
||||||
- '**/*.ini'
|
- '**/*.ini'
|
||||||
- '**/*.toml'
|
- '**/*.toml'
|
||||||
|
- 'Dockerfile'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tox-lint:
|
tox-lint:
|
||||||
# Linting is ran through tox to ensure that the same linter is used by local runners
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# Linting is ran through tox to ensure that the same linter
|
||||||
|
# is used by local runners
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up linting environment
|
- name: Set up linting environment
|
||||||
|
|
@ -41,7 +44,8 @@ jobs:
|
||||||
tox-matrix:
|
tox-matrix:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false # We want to know what specicic versions it fails on
|
# We want to know what specicic versions it fails on
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [
|
os: [
|
||||||
ubuntu-latest,
|
ubuntu-latest,
|
||||||
|
|
@ -67,3 +71,22 @@ jobs:
|
||||||
pip install tox-gh-actions
|
pip install tox-gh-actions
|
||||||
- name: Run tox
|
- name: Run tox
|
||||||
run: tox
|
run: tox
|
||||||
|
docker-build-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Get version from pyproject.toml
|
||||||
|
id: get-version
|
||||||
|
run: |
|
||||||
|
VERSION=$(grep -m1 'version = ' pyproject.toml | cut -d'"' -f2)
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
- name: Build Docker image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
--build-arg VERSION_TAG=${{ steps.get-version.outputs.version }} \
|
||||||
|
-t sherlock-test:latest .
|
||||||
|
- name: Test Docker image runs
|
||||||
|
run: docker run --rm sherlock-test:latest --version
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# 3. Build image with BOTH latest and version tags
|
# 3. Build image with BOTH latest and version tags
|
||||||
# i.e. `docker build -t sherlock/sherlock:0.16.0 -t sherlock/sherlock:latest .`
|
# i.e. `docker build -t sherlock/sherlock:0.16.0 -t sherlock/sherlock:latest .`
|
||||||
|
|
||||||
FROM python:3.12-slim-bullseye as build
|
FROM python:3.12-slim-bullseye AS build
|
||||||
WORKDIR /sherlock
|
WORKDIR /sherlock
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir --upgrade pip
|
RUN pip3 install --no-cache-dir --upgrade pip
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue