Skip to content

Commit 8d1e964

Browse files
authored
Merge pull request #1969 from jauderho/3.0
Add GH Action to build Docker images (3.0 branch)
2 parents ea3f089 + 86543ec commit 8d1e964

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

.github/workflows/docker-3.0.yml

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

Dockerfile.git

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Build using git repo
2+
3+
FROM alpine:3.14
4+
5+
WORKDIR /home/testssl
6+
7+
ARG BUILD_VERSION
8+
ARG ARCHIVE_URL=https://github.com/drwetter/testssl.sh/archive/
9+
ARG URL=https://github.com/drwetter/testssl.sh.git
10+
11+
RUN test -n "${BUILD_VERSION}" \
12+
&& apk update \
13+
&& apk add --no-cache bash procps drill git coreutils libidn curl socat openssl xxd \
14+
&& git clone --depth 1 --branch ${BUILD_VERSION} $URL /home/testssl \
15+
&& addgroup testssl \
16+
&& adduser -G testssl -g "testssl user" -s /bin/bash -D testssl \
17+
&& ln -s /home/testssl/testssl.sh /usr/local/bin/ \
18+
&& mkdir -m 755 -p /home/testssl/etc /home/testssl/bin
19+
20+
USER testssl
21+
22+
ENTRYPOINT ["testssl.sh"]
23+
24+
CMD ["--help"]

0 commit comments

Comments
 (0)