Merge branch 'main' of https://github.com/mysociety/data_common into … #109
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
name: Data Common Docker Base | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch : | |
release: | |
types: [published] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: 'true' | |
- name: Log in to the Container registry | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha | |
type=ref,event=branch | |
type=ref,event=tag | |
- name: Build and push Docker image | |
run: | | |
docker-compose build app | |
docker tag "$IMAGE_NAME" "$REGISTRY/$IMAGE_NAME" | |
for val in $TAGS; do | |
docker tag "$IMAGE_NAME" "$val" | |
done | |
docker push --all-tags "$REGISTRY/$IMAGE_NAME" | |
env: | |
TAGS: ${{ steps.meta.outputs.tags }} | |
DOCKER_BUILDKIT: 1 |