diff options
author | 2022-09-17 20:52:01 +0100 | |
---|---|---|
committer | 2022-09-17 20:54:58 +0100 | |
commit | 6cd837dfe2c3d2b870190a0762d00c78a7e0ca7d (patch) | |
tree | 2e8fc7e48665dd813dcfd0557f67d8e59d0cc03b /.github | |
parent | Initial commit (diff) |
Add a workflow to build base Python images with poetry
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/build.yml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..98d2e61 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: Build + +on: + workflow_dispatch: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + strategy: + matrix: + python_version: [3.9-slim, 3.10-slim, 3-slim] + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + # The current version (v2) of Docker's build-push action uses + # buildx, which comes with BuildKit features that help us speed + # up our builds using additional cache features. Buildx also + # has a lot of other features that are not as relevant to us. + # + # See https://github.com/docker/build-push-action + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Github Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Build and push the container to the GitHub Container + # Repository. The container will be tagged as "latest" + # and with the short SHA of the commit. + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + cache-from: type=registry,ref=ghcr.io/chrislovering/python-poetry-base:${{ matrix.python_version }} + cache-to: type=inline + tags: | + ghcr.io/chrislovering/python-poetry-base:${{ matrix.python_version }} + build-args: | + python_version=${{ matrix.python_version }} |