Skip to content

Commit

Permalink
ci: simplify, update, and use docker layer caching
Browse files Browse the repository at this point in the history
  • Loading branch information
jimeh committed Oct 29, 2023
1 parent 9fd2706 commit 9ad9d7c
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Build and Push Docker Image

on:
push:
branches:
Expand All @@ -8,26 +7,19 @@ on:
jobs:
docker:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- 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 }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: ./dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/${{ github.repository }}:latest
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
push: true
tags: ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 9ad9d7c

Please sign in to comment.