Fix bindata build step and parameterize docker build

This commit is contained in:
Simon Marsh
2021-01-12 09:16:30 +00:00
parent 6179c688be
commit 78ce724171
14 changed files with 28 additions and 178 deletions

19
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM golang:buster AS step_0
#
# IMAGE_ARCH is the binary format of the final output
# BUILD_ARCH is the binaary format of the build host
#
ARG IMAGE_ARCH=amd64
ARG BUILD_ARCH=amd64
#
ENV CGO_ENABLED=0 GOOS=linux GOARCH=$IMAGE_ARCH GO111MODULE=on
WORKDIR /root
COPY . .
# go-bindata is run on the build host as part of the go generate step
RUN GOARCH=$BUILD_ARCH go get -u github.com/kevinburke/go-bindata/...
RUN go generate
RUN go build -ldflags "-w -s" -o /frontend
FROM scratch AS step_1
COPY --from=step_0 /frontend /
ENTRYPOINT ["/frontend"]