Skip to content

Commit 3cf66df

Browse files
authored
Merge pull request #77 from concourse/wolfi
Update Dockerfile for multi-arch building
2 parents b03324d + ff57cc7 commit 3cf66df

File tree

4 files changed

+34
-50
lines changed

4 files changed

+34
-50
lines changed

Dockerfile

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
ARG base_image
1+
ARG base_image=cgr.dev/chainguard/wolfi-base
22
ARG builder_image=concourse/golang-builder
33

4-
FROM ${builder_image} as builder
4+
ARG BUILDPLATFORM
5+
FROM --platform=${BUILDPLATFORM} ${builder_image} AS builder
6+
7+
ARG TARGETOS
8+
ARG TARGETARCH
9+
ENV GOOS=$TARGETOS
10+
ENV GOARCH=$TARGETARCH
11+
512
WORKDIR /src
613
COPY . .
714
RUN go mod download
@@ -10,10 +17,27 @@ RUN set -e; for pkg in $(go list ./...); do \
1017
go test -o "/tests/$(basename $pkg).test" -c $pkg; \
1118
done
1219

20+
FROM ${base_image} AS proxybuilder
21+
RUN apk --no-cache add \
22+
git \
23+
gcc \
24+
make \
25+
openssl-dev
26+
27+
WORKDIR /root
28+
RUN git clone https://github.com/proxytunnel/proxytunnel.git && \
29+
cd proxytunnel && \
30+
make -j4 && \
31+
install -c proxytunnel /usr/bin/proxytunnel && \
32+
cd .. && \
33+
rm -rf proxytunnel
34+
1335
FROM ${base_image} AS resource
14-
USER root
15-
RUN apt update && apt upgrade -y -o Dpkg::Options::="--force-confdef"
16-
RUN apt update && apt install -y jq git make g++ libssl-dev openssh-client
36+
RUN apk --no-cache add \
37+
bash \
38+
jq \
39+
git \
40+
openssh-client
1741
RUN git config --global user.email "git@localhost"
1842
RUN git config --global user.name "git"
1943

@@ -22,15 +46,10 @@ RUN chmod +x /opt/resource/*
2246
COPY --from=builder /assets /opt/go
2347
RUN chmod +x /opt/go/out
2448

25-
WORKDIR /root
26-
RUN git clone https://github.com/proxytunnel/proxytunnel.git && \
27-
cd proxytunnel && \
28-
make -j4 && \
29-
install -c proxytunnel /usr/bin/proxytunnel && \
30-
cd .. && \
31-
rm -rf proxytunnel
49+
COPY --from=proxybuilder /usr/bin/proxytunnel /usr/bin/
3250

3351
FROM resource AS tests
52+
RUN apk --no-cache add git-daemon cmd:ssh-keygen
3453
COPY --from=builder /tests /go/resource-tests/
3554
RUN set -e; for test in /go/resource-tests/*.test; do \
3655
$test; \
@@ -39,7 +58,7 @@ ADD test/ /opt/resource-tests
3958
RUN /opt/resource-tests/all.sh
4059

4160
FROM resource AS integrationtests
42-
RUN apt update && apt install -y squid net-tools
61+
RUN apk --no-cache add squid net-tools
4362
ADD test/ /opt/resource-tests/test
4463
ADD integration-tests /opt/resource-tests/integration-tests
4564
RUN /opt/resource-tests/integration-tests/integration.sh

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ will stop the build.
307307
Run the tests with the following command:
308308

309309
```sh
310-
docker build -t pool-resource --target tests --build-arg base_image=paketobuildpacks/run-jammy-base:latest .
310+
docker build -t pool-resource --target tests .
311311
```
312312

313313
#### Note about the integration tests
@@ -329,7 +329,7 @@ contents to understand the directory structure expected by the integration tests
329329
Then run the tests:
330330

331331
```sh
332-
docker build -t pool-resource --build-arg base_image=concourse/golang-builder --target integrationtests .
332+
docker build -t pool-resource --target integrationtests .
333333
```
334334

335335
### Contributing

ci/Dockerfile

Lines changed: 0 additions & 13 deletions
This file was deleted.

ci/build

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)