Skip to content

Commit 10a520a

Browse files
committed
Merge branch 'main' into symfony
2 parents 1900378 + 4ac3c54 commit 10a520a

File tree

5 files changed

+142
-33
lines changed

5 files changed

+142
-33
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build docker image
22

3+
permissions:
4+
contents: read
5+
36
on: [push]
47

58
jobs:
@@ -29,7 +32,7 @@ jobs:
2932
- { platform: "linux/arm/v7", platform-tag: "armv7" }
3033
- { platform: "linux/arm/v6", platform-tag: "armv6" }
3134
- { platform: "linux/ppc64le", platform-tag: "ppc64le" }
32-
#- { platform: "linux/riscv64", platform-tag: "riscv64" }
35+
- { platform: "linux/riscv64", platform-tag: "riscv64" }
3336
- { platform: "linux/s390x", platform-tag: "s390x" }
3437
- { platform: "linux/386", platform-tag: "386" }
3538
#- { platform: "linux/mips64le", platform-tag: "mips64le" }

.github/workflows/publish.yml

Lines changed: 133 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,142 @@
11
name: Publish Docker image
2+
3+
env:
4+
IMAGE_NAME: docker.io/botsudo/capistrano
5+
HUB_TOOL_VERSION: 0.4.6
6+
7+
permissions:
8+
contents: read
9+
210
on:
311
push:
412
tags:
5-
- 'latest'
6-
- '*.*.*'
13+
- "latest"
14+
- "*.*.*"
715

816
jobs:
9-
push_to_registry:
17+
build-image:
18+
environment:
19+
name: Docker Hub
20+
url: https://hub.docker.com/r/botsudo/capistrano
21+
runs-on: ubuntu-latest
22+
name: Build the Docker image
23+
strategy:
24+
fail-fast: false
25+
max-parallel: 4
26+
matrix:
27+
include:
28+
# All non supported by base image are commented
29+
# This is an example for the base image ruby (alpine variant)
30+
- { platform: "linux/arm64", internal-tag: "arm64" }
31+
- { platform: "linux/amd64", internal-tag: "amd64" }
32+
- { platform: "linux/arm/v7", internal-tag: "armv7" }
33+
- { platform: "linux/arm/v6", internal-tag: "armv6" }
34+
- { platform: "linux/ppc64le", internal-tag: "ppc64le" }
35+
- { platform: "linux/riscv64", internal-tag: "riscv64" }
36+
- { platform: "linux/s390x", internal-tag: "s390x" }
37+
- { platform: "linux/386", internal-tag: "386" }
38+
#- { platform: "linux/mips64le", internal-tag: "mips64le" }
39+
#- { platform: "linux/mips64", internal-tag: "mips64" }
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
# https://github.com/docker/setup-qemu-action
44+
- name: Set up QEMU
45+
uses: docker/setup-qemu-action@v3
46+
# https://github.com/docker/setup-buildx-action
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
- name: Login to DockerHub
50+
uses: docker/login-action@v3
51+
with:
52+
registry: docker.io
53+
username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }}
54+
password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }}
55+
- name: Build and push image
56+
run: make docker-build
57+
env:
58+
DOCKER_BUILDKIT: 1
59+
BUILDKIT_MULTI_PLATFORM: "false"
60+
PLATFORM: ${{ matrix.platform }}
61+
IMAGE_TAG: "${{ env.IMAGE_NAME }}:${{ matrix.internal-tag }}-symfony"
62+
ACTION: push
63+
# Disable provenance to remove the attestation from the pushed image
64+
# See: https://github.com/docker/buildx/issues/1509
65+
# It makes: ${{ env.IMAGE_NAME }}:<arch>-symfony a manifest list
66+
# And docker manifest create does not like that
67+
EXTRA_ARGS: "--provenance=false"
68+
69+
create-final-image:
70+
environment:
71+
name: Docker Hub
72+
url: https://hub.docker.com/r/botsudo/capistrano
73+
runs-on: ubuntu-latest
74+
needs: build-image
75+
name: Create the image manifest
76+
steps:
77+
- name: Login to DockerHub
78+
uses: docker/login-action@v3
79+
with:
80+
registry: docker.io
81+
username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }}
82+
password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }}
83+
- name: Create the manifest
84+
run: |
85+
docker manifest create ${{ env.IMAGE_NAME }}:symfony \
86+
${{ env.IMAGE_NAME }}:arm64-symfony \
87+
${{ env.IMAGE_NAME }}:amd64-symfony \
88+
${{ env.IMAGE_NAME }}:armv7-symfony \
89+
${{ env.IMAGE_NAME }}:armv6-symfony \
90+
${{ env.IMAGE_NAME }}:ppc64le-symfony \
91+
${{ env.IMAGE_NAME }}:riscv64-symfony \
92+
${{ env.IMAGE_NAME }}:s390x-symfony \
93+
${{ env.IMAGE_NAME }}:386-symfony \
94+
--amend
95+
- name: Push the manifest
96+
run: docker manifest push ${{ env.IMAGE_NAME }}:symfony
97+
- name: Inspect the manifest
98+
run: docker manifest inspect ${{ env.IMAGE_NAME }}:symfony
99+
100+
tags-cleanup:
10101
environment:
11-
name: Docker Hub
12-
url: https://hub.docker.com/r/botsudo/capistrano
13-
name: Push Docker image to Docker Hub
102+
name: Docker Hub
103+
url: https://hub.docker.com/r/botsudo/capistrano
14104
runs-on: ubuntu-latest
105+
needs: create-final-image
106+
name: Cleanup build tags
15107
steps:
16-
- name: Check out the repository
17-
uses: actions/checkout@v4
18-
- name: Login to DockerHub
19-
uses: docker/login-action@v3
20-
with:
21-
registry: docker.io
22-
username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }}
23-
password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }}
24-
- name: Get the version
25-
id: get_version
26-
run: echo ::set-output name=VERSION::$(make version)
27-
- name: Build action image
28-
run: make docker-build
29-
env:
30-
IMAGE_TAG: docker.io/botsudo/capistrano:${{ steps.get_version.outputs.VERSION }}-symfony
31-
- name: Sign and push docker image
32-
uses: sudo-bot/action-docker-sign@latest
33-
with:
34-
image-ref: "docker.io/botsudo/capistrano:${{ steps.get_version.outputs.VERSION }}-symfony"
35-
private-key-id: "${{ secrets.DOCKER_PRIVATE_KEY_ID }}"
36-
private-key: ${{ secrets.DOCKER_PRIVATE_KEY }}
37-
private-key-passphrase: ${{ secrets.DOCKER_PRIVATE_KEY_PASSPHRASE }}
108+
- name: Install Docker hub-tool
109+
run: |
110+
curl -sL https://github.com/docker/hub-tool/releases/download/v${{ env.HUB_TOOL_VERSION }}/hub-tool-linux-amd64.tar.gz -o hub-tool-linux.tar.gz
111+
tar --strip-components=1 -xzf ./hub-tool-linux.tar.gz
112+
./hub-tool --version
113+
- name: Login hub-tool
114+
run: |
115+
# Fool the login command (https://github.com/docker/hub-tool/pull/198)
116+
# ./hub-tool login
117+
# Token commands thank to https://stackoverflow.com/a/59334315/5155484
118+
HUB_TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d "{\"username\": \"$DOCKER_USERNAME\", \"password\": \"$DOCKER_PASSWORD\"}" https://hub.docker.com/v2/users/login/ | jq -r .token)
119+
USERNAME="$(printf '%s:' "$DOCKER_USERNAME" | base64 -w0)"
120+
USER_PASS="$(printf '%s:%s' "$DOCKER_USERNAME" "$DOCKER_PASSWORD" | base64 -w0)"
121+
mkdir -p ~/.docker/
122+
printf '{"auths": {"hub-tool": {"auth": "%s"}, "hub-tool-refresh-token": {"auth": "%s"}, "hub-tool-token": { "auth": "%s", "identitytoken": "%s"}}}' \
123+
"$USER_PASS" "$USERNAME" \
124+
"$USERNAME" "$HUB_TOKEN" \
125+
> ~/.docker/config.json
126+
env:
127+
DOCKER_USERNAME: ${{ secrets.DOCKER_REPOSITORY_LOGIN }}
128+
DOCKER_PASSWORD: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }}
129+
- name: Remove the temporary images via hub-tool
130+
run: |
131+
./hub-tool tag rm --verbose --force ${{ env.IMAGE_NAME }}:arm64-symfony || true
132+
./hub-tool tag rm --verbose --force ${{ env.IMAGE_NAME }}:amd64-symfony || true
133+
./hub-tool tag rm --verbose --force ${{ env.IMAGE_NAME }}:armv7-symfony || true
134+
./hub-tool tag rm --verbose --force ${{ env.IMAGE_NAME }}:armv6-symfony || true
135+
./hub-tool tag rm --verbose --force ${{ env.IMAGE_NAME }}:ppc64le-symfony || true
136+
./hub-tool tag rm --verbose --force ${{ env.IMAGE_NAME }}:riscv64-symfony || true
137+
./hub-tool tag rm --verbose --force ${{ env.IMAGE_NAME }}:s390x-symfony || true
138+
./hub-tool tag rm --verbose --force ${{ env.IMAGE_NAME }}:386-symfony || true
139+
./hub-tool tag ls --verbose ${{ env.IMAGE_NAME }}
140+
- name: Logout hub-tool
141+
if: always()
142+
run: rm ~/.docker/config.json

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ docker-build:
2121
./docker
2222

2323
docker-test:
24-
docker-compose -f ./docker/docker-compose-latest.test.yml up
24+
docker compose -f ./docker/docker-compose-latest.test.yml up
2525

2626
tag:
2727
@echo "Tagging: $(shell make version)-symfony"

docker/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
FROM ruby:3-alpine3.20 as builder
1+
FROM ruby:3-alpine3.21 AS builder
22

33
COPY Gemfile ./
44

55
RUN apk add --update --no-cache make ruby-dev gcc musl-dev && \
66
gem install bundler --user-install && \
77
bundle install --no-cache && \
8+
bundle update --bundler && \
89
apk del gcc make musl-dev ruby-dev && \
910
rm -rf /usr/local/bundle/cache /root/.bundle
1011

11-
FROM ruby:3-alpine3.20
12+
FROM ruby:3-alpine3.21
1213

1314
# Metadata params
1415
ARG VCS_REF

docker/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'https://rubygems.org'
22

3-
gem 'capistrano', '3.18.1'
3+
gem 'capistrano', '3.19.2'
44
gem 'capistrano-symfony', '~> 2.0.0'
55
# For SSH to work on some machines
66
gem 'ed25519', '~> 1.3'

0 commit comments

Comments
 (0)