1- ARG base_image
1+ ARG base_image=cgr.dev/chainguard/wolfi-base
22ARG 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+
512WORKDIR /src
613COPY . .
714RUN 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+
1335FROM ${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
1741RUN git config --global user.email "git@localhost"
1842RUN git config --global user.name "git"
1943
@@ -22,15 +46,10 @@ RUN chmod +x /opt/resource/*
2246COPY --from=builder /assets /opt/go
2347RUN 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
3351FROM resource AS tests
52+ RUN apk --no-cache add git-daemon cmd:ssh-keygen
3453COPY --from=builder /tests /go/resource-tests/
3554RUN set -e; for test in /go/resource-tests/*.test; do \
3655 $test; \
@@ -39,7 +58,7 @@ ADD test/ /opt/resource-tests
3958RUN /opt/resource-tests/all.sh
4059
4160FROM resource AS integrationtests
42- RUN apt update && apt install -y squid net-tools
61+ RUN apk --no-cache add squid net-tools
4362ADD test/ /opt/resource-tests/test
4463ADD integration-tests /opt/resource-tests/integration-tests
4564RUN /opt/resource-tests/integration-tests/integration.sh
0 commit comments