Skip to content

Commit dd02a5f

Browse files
committed
Add Docker build CI
1 parent 587eb3d commit dd02a5f

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/build.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
target:
14+
- name: with rootfs
15+
image-name: menci/syzoj-judge
16+
dockerfile: Dockerfile
17+
- name: without rootfs
18+
image-name: menci/syzoj-judge-norootfs
19+
dockerfile: Dockerfile.NOROOTFS
20+
name: Build and Push (${{ matrix.target.name }})
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
- name: Set up QEMU
26+
uses: docker/setup-buildx-action@v1
27+
- name: Login to DockerHub
28+
uses: docker/login-action@v1
29+
with:
30+
username: ${{ secrets.DOCKERHUB_USERNAME }}
31+
password: ${{ secrets.DOCKERHUB_TOKEN }}
32+
- name: Generate Tag List
33+
run: |
34+
echo "TAGS<<EOF" >> $GITHUB_ENV
35+
36+
HASH_SHORT="$(git rev-parse --short HEAD)"
37+
echo $IMAGE_NAME:$HASH_SHORT >> $GITHUB_ENV
38+
echo $IMAGE_NAME:latest >> $GITHUB_ENV
39+
40+
echo "EOF" >> $GITHUB_ENV
41+
env:
42+
IMAGE_NAME: ${{ matrix.target.image-name }}
43+
- name: Build and Push
44+
uses: docker/build-push-action@v2
45+
with:
46+
platforms: linux/amd64
47+
push: true
48+
tags: ${{ env.TAGS }}
49+
file: ${{ matrix.target.dockerfile }}

0 commit comments

Comments
 (0)