Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ministryofjustice/data-platform-dja…
Browse files Browse the repository at this point in the history
…ngo-proof-of-concept
  • Loading branch information
julialawrence committed Oct 19, 2023
2 parents 6e9953f + 5f05956 commit 1ff4b15
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ name: Build and Push Docker Image

on:
push:
branches:
- main

tags:
- '*'
release:
types: [published]

permissions:
packages: write
contents: read
jobs:
build-and-push:
runs-on: ubuntu-latest
Expand All @@ -13,24 +18,24 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build and Push Docker Image
run: |
docker buildx create --use
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/${{ github.repository }}:${{ github.ref }} \
-t ghcr.io/${{ github.repository }}:latest \
-f Dockerfile .
docker buildx stop ${GITHUB_RUN_ID}
env:
DOCKER_CLI_AGGREGATE: 1

- name: Clean up
run: |
docker buildx rm --all
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 1ff4b15

Please sign in to comment.