Skip to content

Commit 04a6f63

Browse files
committed
update Dockerfile to use wolfi for building multi-arch images
Signed-off-by: Taylor Silva <dev@taydev.net>
1 parent b139c82 commit 04a6f63

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

Dockerfile

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
ARG base_image=concourse/resource-types-base-image-static:latest
1+
ARG base_image=cgr.dev/chainguard/wolfi-base
22
ARG builder_image=concourse/golang-builder
33

4-
FROM ${builder_image} AS builder
5-
COPY . $GOPATH/src/github.com/concourse/github-release-resource
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+
12+
COPY . /src
13+
WORKDIR /src
614
ENV CGO_ENABLED=0
7-
WORKDIR $GOPATH/src/github.com/concourse/github-release-resource
8-
RUN go mod vendor
9-
RUN go build -o /assets/out github.com/concourse/github-release-resource/cmd/out
10-
RUN go build -o /assets/in github.com/concourse/github-release-resource/cmd/in
11-
RUN go build -o /assets/check github.com/concourse/github-release-resource/cmd/check
15+
RUN go mod download
16+
RUN go build -o /assets/out ./cmd/out
17+
RUN go build -o /assets/in ./cmd/in
18+
RUN go build -o /assets/check ./cmd/check
1219
RUN set -e; for pkg in $(go list ./...); do \
1320
go test -o "/tests/$(basename $pkg).test" -c $pkg; \
1421
done
1522

1623
FROM ${base_image} AS resource
17-
USER root
1824
COPY --from=builder /assets /opt/resource
1925

2026
FROM resource AS tests

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ will stop the build.
210210
Run the tests with the following command:
211211

212212
```sh
213-
docker build -t github-release-resource --target tests --build-arg base_image=concourse/resource-types-base-image-static:latest .
213+
docker build -t github-release-resource --target tests .
214214
```
215215

216216
### Contributing

0 commit comments

Comments
 (0)