Skip to content

Commit 1fcac87

Browse files
committed
Use GH Action to build Docker images
1 parent ea3f089 commit 1fcac87

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/docker-3.0.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: docker-3.0
2+
3+
on:
4+
push:
5+
branches:
6+
- 3.0
7+
workflow_dispatch:
8+
schedule:
9+
- cron: "0 8 * * 1"
10+
11+
env:
12+
BUILD_VERSION: "3.0"
13+
DOCKER_CLI_EXPERIMENTAL: enabled
14+
REPOSITORY: ${{ github.actor }}/testssl.sh
15+
16+
jobs:
17+
18+
deploy:
19+
runs-on: ubuntu-20.04
20+
21+
steps:
22+
- name: Source checkout
23+
uses: actions/checkout@v2.3.4
24+
25+
- name: Setup QEMU
26+
id: qemu
27+
uses: docker/setup-qemu-action@v1.2.0
28+
29+
- name: Setup Buildx
30+
id: buildx
31+
uses: docker/setup-buildx-action@v1
32+
33+
- name: Set Docker metadata
34+
id: docker_meta
35+
uses: docker/metadata-action@v3
36+
with:
37+
images: ${{ env.REPOSITORY }}
38+
labels: |
39+
org.opencontainers.image.version=${{ env.BUILD_VERSION }}
40+
org.opencontainers.image.revision=${{ github.sha }}
41+
org.opencontainers.image.title=${{ env.REPOSITORY }}
42+
43+
- name: GitHub login
44+
if: ${{ github.event_name != 'pull_request' }}
45+
uses: docker/login-action@v1.10.0
46+
with:
47+
registry: ghcr.io
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Build and push
52+
uses: docker/build-push-action@v2.6.1
53+
with:
54+
push: ${{ github.event_name != 'pull_request' }}
55+
context: .
56+
file: Dockerfile.git
57+
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le
58+
build-args: BUILD_VERSION
59+
cache-from: type=gha, scope=${{ github.workflow }}
60+
cache-to: type=gha, scope=${{ github.workflow }}
61+
labels: ${{ steps.docker_meta.outputs.labels }}
62+
tags: |
63+
ghcr.io/${{ env.REPOSITORY }}:${{ env.BUILD_VERSION }}

0 commit comments

Comments
 (0)