-
Notifications
You must be signed in to change notification settings - Fork 560
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: docker images for latest release and main branch (#2116)
This PR adds docker image building to the github actions workflow. Two images are built: - unstable: This is built from the current branch - latest: This is built from the version of rdflib in `docker/latest/requirements.txt`, but as this will be updated by dependabot it will essentially always be the latest version. The resulting image references are: - `ghcr.io/rdflib/rdflib:unstable` - `ghcr.io/rdflib/rdflib:latest` with an alias `ghcr.io/rdflib/rdflib:${rdflib_version}`, e.g. `ghcr.io/rdflib/rdflib:6.2.0`. As dependabot is conifgured for both pyton and docker dependencies, any change/update to dependencies will result in a new image being built. To avoid spurious changes in image digests the existing image is used as the cache source, so if the requirements.txt and Dockerfile for `ghcr.io/rdflib/rdflib:latest` has not changed then a new image should not be published for it even if the build runs. I have tested this in my forked repo, but there may be some kinks to still work out.
- Loading branch information
Showing
11 changed files
with
251 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
.mypy_cache | ||
.pytest_cache | ||
.git | ||
docs/ | ||
test/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 10 | ||
ignore: | ||
- dependency-name: sphinx | ||
versions: | ||
- 3.4.3 | ||
- 3.5.2 | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 10 | ||
ignore: | ||
- dependency-name: sphinx | ||
versions: | ||
- 3.4.3 | ||
- 3.5.2 | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
- package-ecosystem: docker | ||
directory: docker/latest/ | ||
schedule: | ||
interval: weekly | ||
- package-ecosystem: pip | ||
directory: docker/latest/ | ||
schedule: | ||
interval: weekly | ||
- package-ecosystem: docker | ||
directory: docker/unstable/ | ||
schedule: | ||
interval: weekly | ||
- package-ecosystem: pip | ||
directory: docker/unstable/ | ||
schedule: | ||
interval: weekly |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Docker Images | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
setup: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
outputs: | ||
docker-push: ${{ steps.vars.outputs.docker-push }} | ||
oci-reference: ${{ steps.vars.outputs.oci-reference }} | ||
steps: | ||
- id: vars | ||
run: | | ||
echo ::set-output name=github-ref::${{ github.ref }} | ||
echo ::set-output name=docker-push::${{ github.ref == 'refs/heads/main' }} | ||
echo ::set-output name=oci-reference::ghcr.io/$( echo "${{ github.repository}}" | tr '[:upper:]' '[:lower:]' ) | ||
- id: vars-dump | ||
run: | | ||
echo "steps.vars.github-ref = ${{ steps.vars.outputs.github-ref }}" | ||
echo "steps.vars.docker-push = ${{ steps.vars.outputs.docker-push }}" | ||
echo "steps.vars.oci-reference = ${{ steps.vars.outputs.oci-reference }}" | ||
build: | ||
needs: setup | ||
permissions: | ||
contents: read | ||
packages: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Install Task | ||
uses: arduino/setup-task@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build images | ||
shell: bash | ||
run: | | ||
task \ | ||
OCI_REFERENCE="${{ needs.setup.outputs.oci-reference }}" \ | ||
docker:latest docker:unstable | ||
push: | ||
if: "${{ needs.setup.outputs.docker-push == 'true' }}" | ||
needs: [ setup, build ] | ||
permissions: | ||
id-token: write | ||
packages: write | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- name: Install Task | ||
uses: arduino/setup-task@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Push images | ||
shell: bash | ||
run: | | ||
task \ | ||
DOCKER_PUSH=true \ | ||
OCI_REFERENCE="${{ needs.setup.outputs.oci-reference }}" \ | ||
docker:latest docker:unstable |
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM docker.io/library/python:3.10-slim@sha256:c212a18a48efd4de1d6455f197538563d9cc312775761f14c50866c9a7eabd0e | ||
|
||
COPY docker/latest/requirements.txt /var/tmp/build/ | ||
|
||
RUN \ | ||
pip install --no-deps -r /var/tmp/build/requirements.txt && \ | ||
rdfpipe --version | ||
|
||
ENTRYPOINT [ ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
rdflib==6.2.0 | ||
html5lib |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# This file is autogenerated by pip-compile with python 3.10 | ||
# To update, run: | ||
# | ||
# pip-compile docker/latest/requirements.in | ||
# | ||
html5lib==1.1 | ||
# via -r docker/latest/requirements.in | ||
isodate==0.6.1 | ||
# via rdflib | ||
pyparsing==3.0.9 | ||
# via rdflib | ||
rdflib==6.2.0 | ||
# via -r docker/latest/requirements.in | ||
six==1.16.0 | ||
# via html5lib | ||
webencodings==0.5.1 | ||
# via html5lib | ||
|
||
# The following packages are considered to be unsafe in a requirements file: | ||
# setuptools | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM docker.io/library/python:3.10-slim@sha256:c212a18a48efd4de1d6455f197538563d9cc312775761f14c50866c9a7eabd0e | ||
|
||
COPY docker/unstable/requirements.txt /var/tmp/build/ | ||
|
||
RUN \ | ||
pip install -r /var/tmp/build/requirements.txt | ||
|
||
COPY dist/*.whl /var/tmp/build/ | ||
|
||
RUN \ | ||
pip install --no-deps /var/tmp/build/*.whl && \ | ||
rdfpipe --version | ||
|
||
ENTRYPOINT [ ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# This file is autogenerated by pip-compile with python 3.10 | ||
# To update, run: | ||
# | ||
# pip-compile --output-file=docker/unstable/requirements.txt requirements.txt | ||
# | ||
html5lib==1.1 | ||
# via -r requirements.txt | ||
isodate==0.6.1 | ||
# via -r requirements.txt | ||
pyparsing==3.0.9 | ||
# via -r requirements.txt | ||
six==1.16.0 | ||
# via | ||
# html5lib | ||
# isodate | ||
webencodings==0.5.1 | ||
# via html5lib | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
html5lib | ||
isodate | ||
pyparsing | ||
importlib-metadata; python_version < '3.8.0' |