Skip to content

Commit 5174cbb

Browse files
authored
auto-push docker container
1 parent 9dc2a07 commit 5174cbb

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/docker.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 'AMD64/ARM64 image builder'
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v1
17+
with:
18+
platforms: all
19+
20+
- name: Set up Docker Buildx
21+
id: buildx
22+
uses: docker/setup-buildx-action@v1
23+
24+
- name: Cache Docker layers
25+
uses: actions/cache@v2
26+
with:
27+
path: /tmp/.buildx-cache
28+
key: ${{ runner.os }}-buildx-${{ github.sha }}
29+
restore-keys: |
30+
${{ runner.os }}-buildx-
31+
- name: Login to DockerHub
32+
if: github.event_name != 'pull_request'
33+
uses: docker/login-action@v1
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Build and push
40+
id: docker_build
41+
uses: docker/build-push-action@v2
42+
with:
43+
builder: ${{ steps.buildx.outputs.name }}
44+
context: .
45+
platforms: linux/amd64,linux/arm64
46+
push: ${{ github.event_name != 'pull_request' }}
47+
tags: ghcr.io/acm-uiuc/linkry:latest,ghcr.io/acm-uiuc/linkry:${{github.ref_name}}
48+
cache-from: type=local,src=/tmp/.buildx-cache
49+
cache-to: type=local,dest=/tmp/.buildx-cache
50+
51+
- name: Image digest
52+
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)