Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
324 changes: 324 additions & 0 deletions .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,327 @@ jobs:
run: |
git diff --exit-code

build-3-20:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Display system info (linux)
run: |
set -e
hostname
whoami
cat /etc/*release
lscpu
free
df -h
pwd
docker info
docker version

# See: https://github.com/docker/build-push-action/blob/v2.6.1/docs/advanced/cache.md#github-cache
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-3.20-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-3.20-
${{ runner.os }}-buildx-

- name: Login to Docker Hub registry
# Run on master and tags
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}

# This step generates the docker tags
- name: Prepare
id: prep-3-20
run: |
set -e

# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )

# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )

# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="3.20"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"

# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT

- name: 3.20 - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: variants/3.20
platforms:
push: false
tags: |
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 3.20 - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: variants/3.20
platforms:
push: true
tags: |
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 3.20 - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: variants/3.20
platforms:
push: true
tags: |
${{ github.repository }}:${{ steps.prep-3-20.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20.outputs.REF_SHA_VARIANT }}
${{ github.repository }}:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-3-20-mysqlclient
run: |
set -e

# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )

# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )

# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="3.20-mysqlclient"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"

# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT

- name: 3.20-mysqlclient - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: variants/3.20-mysqlclient
platforms:
push: false
tags: |
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 3.20-mysqlclient - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: variants/3.20-mysqlclient
platforms:
push: true
tags: |
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 3.20-mysqlclient - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: variants/3.20-mysqlclient
platforms:
push: true
tags: |
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-3-20-openssl
run: |
set -e

# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )

# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )

# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="3.20-openssl"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"

# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT

- name: 3.20-openssl - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: variants/3.20-openssl
platforms:
push: false
tags: |
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 3.20-openssl - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: variants/3.20-openssl
platforms:
push: true
tags: |
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 3.20-openssl - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: variants/3.20-openssl
platforms:
push: true
tags: |
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-openssl.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# This step generates the docker tags
- name: Prepare
id: prep-3-20-mysqlclient-openssl
run: |
set -e

# Get ref, i.e. <branch_name> from refs/heads/<branch_name>, or <tag-name> from refs/tags/<tag_name>. E.g. 'master' or 'v0.0.0'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )

# Get short commit hash E.g. 'abc0123'
SHA=$( echo "${GITHUB_SHA}" | cut -c1-7 )

# Generate docker image tags
# E.g. 'v0.0.0-<variant>' and 'v0.0.0-abc0123-<variant>'
# E.g. 'master-<variant>' and 'master-abc0123-<variant>'
VARIANT="3.20-mysqlclient-openssl"
REF_VARIANT="${REF}-${VARIANT}"
REF_SHA_VARIANT="${REF}-${SHA}-${VARIANT}"

# Pass variables to next step
echo "VARIANT_BUILD_DIR=$VARIANT_BUILD_DIR" >> $GITHUB_OUTPUT
echo "VARIANT=$VARIANT" >> $GITHUB_OUTPUT
echo "REF_VARIANT=$REF_VARIANT" >> $GITHUB_OUTPUT
echo "REF_SHA_VARIANT=$REF_SHA_VARIANT" >> $GITHUB_OUTPUT

- name: 3.20-mysqlclient-openssl - Build (PRs)
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: variants/3.20-mysqlclient-openssl
platforms:
push: false
tags: |
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 3.20-mysqlclient-openssl - Build and push (master)
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: variants/3.20-mysqlclient-openssl
platforms:
push: true
tags: |
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: 3.20-mysqlclient-openssl - Build and push (release)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: variants/3.20-mysqlclient-openssl
platforms:
push: true
tags: |
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_VARIANT }}
${{ github.repository }}:${{ steps.prep-3-20-mysqlclient-openssl.outputs.REF_SHA_VARIANT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

build-3-17:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -998,6 +1319,7 @@ jobs:

update-draft-release:
needs:
- build-3-20
- build-3-17
- build-3-15
- build-3-12
Expand All @@ -1014,6 +1336,7 @@ jobs:

publish-draft-release:
needs:
- build-3-20
- build-3-17
- build-3-15
- build-3-12
Expand All @@ -1032,6 +1355,7 @@ jobs:

update-dockerhub-description:
needs:
- build-3-20
- build-3-17
- build-3-15
- build-3-12
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Packages included for all images: `curl`, `wget`

| Tag | Dockerfile Build Context |
|:-------:|:---------:|
| `:3.20`, `:latest` | [View](variants/3.20) |
| `:3.20-mysqlclient` | [View](variants/3.20-mysqlclient) |
| `:3.20-openssl` | [View](variants/3.20-openssl) |
| `:3.20-mysqlclient-openssl` | [View](variants/3.20-mysqlclient-openssl) |
| `:3.17`, `:latest` | [View](variants/3.17) |
| `:3.17-mysqlclient` | [View](variants/3.17-mysqlclient) |
| `:3.17-openssl` | [View](variants/3.17-openssl) |
Expand All @@ -32,15 +36,15 @@ Example 1: Create one cron that runs as `root`
```sh
docker run -it \
-e CRON='* * * * * /bin/echo "hello"' \
theohbrothers/docker-alpine-cron:3.17
theohbrothers/docker-alpine-cron:3.20
```

Example 2: Create two crons that run as `root`

```sh
docker run -it \
-e CRON='* * * * * /bin/echo "hello"\n* * * * * /bin/echo "world"' \
theohbrothers/docker-alpine-cron:3.17
theohbrothers/docker-alpine-cron:3.20
```

Example 3: Create two crons that run as UID `3000` and GID `4000`
Expand All @@ -50,7 +54,7 @@ docker run -it \
-e CRON='* * * * * /bin/echo "hello"\n* * * * * /bin/echo "world"' \
-e CRON_UID=3000 \
-e CRON_GID=4000 \
theohbrothers/docker-alpine-cron:3.17
theohbrothers/docker-alpine-cron:3.20
```

### Environment variables
Expand Down
1 change: 1 addition & 0 deletions generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$local:VARIANTS_DISTRO_VERSIONS = @(
'3.20'
'3.17'
'3.15'
'3.12'
Expand Down
Loading