Skip to content

Commit b419823

Browse files
committed
Build multiarch from same step
1 parent b15de40 commit b419823

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,12 @@ jobs:
1717
build:
1818
name: Build
1919
runs-on: [self-hosted, linux]
20-
strategy:
21-
matrix:
22-
arch: [amd64, arm64]
23-
include:
24-
- arch: amd64
25-
gomplate_sha256: 603539aac4e09f98a8ca5b6e5da0c21213221206dc7175a5644255c7a22b936d
26-
- arch: arm64
27-
gomplate_sha256: 3352ef521977ee39cdd406a9a7943d0b5f29772e5542995416bf093b90bbae2c
2820
needs: test
2921
steps:
3022
- uses: actions/checkout@v3
3123
- uses: secondlife/action-build-docker@v1
3224
with:
33-
image: platform/nginx-proxy
34-
platforms: linux/${{ matrix.arch }}
25+
image: /platform/nginx-proxy
26+
platforms: linux/amd64,linux/arm64
3527
promote: ${{ startsWith(github.ref, 'refs/tags/v') }}
3628
jfrog-token: ${{ secrets.SHARED_JFROG_TOKEN }}
37-
build-args: |
38-
GOMPLATE_ARCH=${{ matrix.arch }}
39-
GOMPLATE_SHA256=${{ matrix.gomplate_sha256 }}

Dockerfile

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
############
2-
# Base
2+
# Gomplate
33
############
4-
ARG ARCH=
5-
FROM artifactory.secondlife.io/dockerhub/${ARCH}alpine:3 AS base
6-
ARG GOMPLATE_ARCH=amd64
7-
ARG GOMPLATE_SHA256=603539aac4e09f98a8ca5b6e5da0c21213221206dc7175a5644255c7a22b936d
4+
FROM artifactory.secondlife.io/dockerhub/alpine:3 AS gomplate
5+
ARG TARGETPLATFORM=linux/amd64
86
ARG GOMPLATE_VERSION=3.10.0
9-
ADD https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-${GOMPLATE_ARCH}-slim /usr/local/bin/gomplate
10-
RUN echo "${GOMPLATE_SHA256} /usr/local/bin/gomplate" | sha256sum -c \
11-
&& chmod +x /usr/local/bin/gomplate \
12-
&& apk add --no-cache \
7+
ARG GOMPLATE_AMD64_SHA256=603539aac4e09f98a8ca5b6e5da0c21213221206dc7175a5644255c7a22b936d
8+
ARG GOMPLATE_ARM64_SHA256=3352ef521977ee39cdd406a9a7943d0b5f29772e5542995416bf093b90bbae2c
9+
RUN apk add --no-cache curl bash
10+
SHELL ["/bin/bash", "-c"]
11+
RUN ARCH=${TARGETPLATFORM/linux\//} \
12+
&& curl -Lf https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-${ARCH}-slim -o /tmp/gomplate \
13+
&& sha_envvar="GOMPLATE_${ARCH^^}_SHA256" \
14+
&& GOMPLATE_SHA256="${!sha_envvar}" \
15+
&& echo "${GOMPLATE_SHA256} /tmp/gomplate" | sha256sum -c \
16+
&& chmod +x /tmp/gomplate
17+
18+
############
19+
# Base
20+
############
21+
FROM artifactory.secondlife.io/dockerhub/alpine:3 AS base
22+
COPY --from=gomplate /tmp/gomplate /usr/local/bin/
23+
RUN apk add --no-cache \
1324
bash \
1425
nginx \
1526
nginx-mod-http-headers-more

0 commit comments

Comments
 (0)