File tree Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Original file line number Diff line number Diff line change 13
13
id : filter
14
14
with :
15
15
filters : |
16
- dockerfiles :
16
+ dockerfile :
17
17
- 'Dockerfile*'
18
18
19
19
- name : Build images
@@ -58,12 +58,14 @@ jobs:
58
58
name : Validate dev-container
59
59
runs-on : ubuntu-latest
60
60
steps :
61
+ - uses : actions/checkout@v3
62
+
61
63
- uses : dorny/paths-filter@v2
62
64
id : filter
63
65
with :
64
66
filters : |
65
67
dockerfile:
66
- - 'Dockerfile *'
68
+ - '.devcontainer/* *'
67
69
68
70
- name : Build images
69
71
if : steps.filter.outputs.dockerfile == 'true'
Original file line number Diff line number Diff line change 44
44
username : ${{ github.actor }}
45
45
password : ${{ secrets.GITHUB_TOKEN }}
46
46
47
+ - name : Set up Docker Buildx
48
+ uses : docker/setup-buildx-action@v1
49
+
47
50
- name : Build and push Docker image
48
51
run : make publish
49
52
env :
Original file line number Diff line number Diff line change 1
- FROM golang:1.17-alpine3.14 as builder
1
+ FROM --platform=$BUILDPLATFORM golang:1.17-alpine3.14 as builder
2
2
RUN apk --no-cache add git
3
3
WORKDIR /go/src/build
4
4
COPY . .
5
- RUN export CGO_ENABLED=0 \
6
- && mkdir -p dist \
5
+
6
+ # https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
7
+ ARG TARGETOS
8
+ ARG TARGETARCH
9
+ RUN mkdir -p dist \
7
10
&& go mod vendor \
8
- && go build -o dist/helm-repo-updater .
11
+ && CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(ARCH) go build -o dist/helm-repo-updater .
9
12
10
13
FROM alpine:3.14
11
14
ENV SSH_KNOWN_HOSTS="~/.ssh/known_hosts"
Original file line number Diff line number Diff line change @@ -77,12 +77,11 @@ gofumpt: $(GOBIN_TOOL)
77
77
78
78
.PHONY : docker-build
79
79
docker-build : # # Build main image
80
- docker build -f Dockerfile -t $(IMAGE ) -t $(IMAGE_LATEST ) .
80
+ DOCKER_BUILDKIT=1 docker build -f Dockerfile -t $(IMAGE ) -t $(IMAGE_LATEST ) .
81
81
82
82
.PHONY : publish
83
83
publish : docker-build # # Publish main image
84
- docker push $(IMAGE )
85
- docker push $(IMAGE_LATEST )
84
+ docker buildx build --push --platform=linux/amd64,linux/arm64 . -t $(IMAGE ) -t $(IMAGE_LATEST )
86
85
87
86
.PHONY : docker-dev-container
88
87
docker-dev-container : # # Build devcontainer image
You can’t perform that action at this time.
0 commit comments