Skip to content

Commit 68c148d

Browse files
authored
Merge pull request #2768 from polarathene/fix/ci-docker-3.2
ci(fix): 3.2 - Docker support adjustments
2 parents 7f48b5f + 7efd56d commit 68c148d

3 files changed

Lines changed: 32 additions & 23 deletions

File tree

.github/workflows/docker-3.2.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ on:
55
branches:
66
- 3.2
77
workflow_dispatch:
8+
# Every week at 8am on Mondays, publish the 3.2 branch:
9+
# NOTE: `schedule` event is only triggered for the default branch:
10+
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
811
schedule:
912
- cron: "0 8 * * 1"
1013

1114
env:
12-
BUILD_VERSION: "3.2"
13-
DOCKER_CLI_EXPERIMENTAL: enabled
15+
GIT_BRANCH: "3.2"
1416

1517
jobs:
1618

@@ -23,7 +25,7 @@ jobs:
2325

2426
- name: Setup QEMU
2527
id: qemu
26-
uses: docker/setup-qemu-action@v3.6.0
28+
uses: docker/setup-qemu-action@v3
2729

2830
- name: Setup Buildx
2931
id: buildx
@@ -35,29 +37,30 @@ jobs:
3537
with:
3638
images: ${{ github.repository }}
3739
labels: |
38-
org.opencontainers.image.version=${{ env.BUILD_VERSION }}
40+
org.opencontainers.image.version=${{ env.GIT_BRANCH }}
3941
org.opencontainers.image.revision=${{ github.sha }}
4042
org.opencontainers.image.title=${{ github.repository }}
4143
4244
- name: GitHub login
4345
if: ${{ github.event_name != 'pull_request' }}
44-
uses: docker/login-action@v3.4.0
46+
uses: docker/login-action@v3
4547
with:
4648
registry: ghcr.io
47-
username: ${{ github.actor }}
49+
username: ${{ github.repository_owner }}
4850
password: ${{ secrets.GITHUB_TOKEN }}
4951

5052
- name: Build and push
51-
uses: docker/build-push-action@v6.16.0
53+
uses: docker/build-push-action@v6
5254
with:
5355
push: ${{ github.event_name != 'pull_request' }}
5456
context: .
55-
file: Dockerfile-alpine
57+
file: Dockerfile.alpine
5658
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/ppc64le
57-
build-args: BUILD_VERSION
59+
build-args:
60+
- GIT_BRANCH
5861
cache-from: type=gha, scope=${{ github.workflow }}
5962
cache-to: type=gha, scope=${{ github.workflow }}
6063
labels: ${{ steps.docker_meta.outputs.labels }}
6164
tags: |
62-
ghcr.io/${{ github.repository }}:${{ env.BUILD_VERSION }}
65+
ghcr.io/${{ github.repository }}:${{ env.GIT_BRANCH }}
6366
ghcr.io/${{ github.repository }}:latest
File renamed without changes.

Dockerfile.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ Use a volume bind mount to a local host directory to access the files outside of
1717
docker run --rm -it -v /tmp:/data --workdir /data ghcr.io/testssl/testssl.sh:3.2 --htmlfile ./ example.com
1818
```
1919

20-
**NOTE:**
21-
- The UID/GID ownership of the file will be created by the container user `testssl` (`1000:1000`), with permissions `644`.
22-
- Your host directory must permit the `testssl` container user or group to write to that host volume. You could alternatively use [`docker cp`](https://docs.docker.com/reference/cli/docker/container/cp/).
20+
> [!NOTE]
21+
> - The UID/GID ownership of the file will be created by the container user `testssl` (`1000:1000`), with permissions `644`.
22+
> - Your host directory must permit the `testssl` container user or group to write to that host volume. You could alternatively use [`docker cp`](https://docs.docker.com/reference/cli/docker/container/cp/).
2323
24-
### From DockerHub or GHCR
24+
## Images
25+
26+
### Available at DockerHub and GHCR
2527

2628
You can pull the image from either of these registries:
2729
- DockerHub: [`drwetter/testssl.sh`](https://hub.docker.com/r/drwetter/testssl.sh)
@@ -31,7 +33,7 @@ Supported tags:
3133
- `3.2` / `latest`
3234
- `3.0` is the old stable version ([soon to become EOL](https://github.com/testssl/testssl.sh/tree/3.0#status))
3335

34-
### Building
36+
### Building the `testssl.sh` container image
3537

3638
You can build with a standard `git clone` + `docker build`. Tagging the image will make it easier to reference.
3739

@@ -41,26 +43,30 @@ git clone --branch 3.2 --depth 1 https://github.com/testssl/testssl.sh .
4143
docker build --tag localhost/testssl.sh:3.2 .
4244
```
4345

44-
There are two base images available:
45-
- `Dockerfile` (openSUSE Leap), glibc-based + faster.
46-
- `Dockerfile-alpine` (Alpine), musl-based + half the size.
46+
There are two base images supported:
47+
- openSUSE Leap ([`Dockerfile`](./Dockerfile)), glibc-based + faster.
48+
- Alpine ([`Dockerfile`](./Dockerfile.alpine)), musl-based + half the size.
49+
50+
The Alpine variant is made available if you need broarder platform support, or an image about 30MB smaller at the expense of slightly slower performance.
4751

48-
Alpine is made available if you need broarder platform support or an image about 30MB smaller at the expense of speed.
52+
#### Tip - Remote build context + `Dockerfile`
4953

50-
#### Remote build context + `Dockerfile`
5154
You can build with a single command instead via:
5255

5356
```bash
5457
docker build --tag localhost/testssl.sh:3.2 https://github.com/testssl/testssl.sh.git#3.2
5558
```
5659

57-
This will produce a slightly larger image however as `.dockerignore` is not supported with remote build contexts.
60+
> [!NOTE]
61+
> This will produce a slightly larger image as [`.dockerignore` is not supported with remote build contexts](https://github.com/docker/buildx/issues/3169).
62+
63+
---
5864

59-
If you would like to build the Alpine image instead this way, just provide the alternative `Dockerfile` via `--file`:
65+
To build the Alpine image instead, additionally provide the ([alternative `Dockerfile`](./Dockerfile.alpine)) via the `--file` option:
6066

6167
```bash
6268
docker build \
6369
--tag localhost/testssl.sh:3.2-alpine \
64-
--file https://raw.githubusercontent.com/testssl/testssl.sh/3.2/Dockerfile-alpine \
70+
--file https://raw.githubusercontent.com/testssl/testssl.sh/3.2/Dockerfile.alpine \
6571
https://github.com/testssl/testssl.sh.git#3.2
6672
```

0 commit comments

Comments
 (0)