Skip to content

Commit

Permalink
Docker: fix docker builds
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
  • Loading branch information
rustatian committed Jul 18, 2022
1 parent 2e97044 commit 9589198
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# https://docs.docker.com/buildx/working-with-buildx/
# TARGETPLATFORM if not empty OR linux/amd64 by default
FROM --platform=${TARGETPLATFORM:-linux/amd64} golang:1.18.4-alpine as builder
FROM --platform=${TARGETPLATFORM:-linux/amd64} golang:1.18-alpine as builder

# app version and build date must be passed during image building (version without any prefix).
# e.g.: `docker build --build-arg "APP_VERSION=1.2.3" --build-arg "BUILD_TIME=$(date +%FT%T%z)" .`
Expand All @@ -19,9 +19,10 @@ ENV LDFLAGS="-s \
RUN set -x
RUN go mod download
RUN go mod tidy -go 1.18
RUN CGO_ENABLED=0 go build -trimpath -ldflags "$LDFLAGS" -o ./velox ./vx

FROM --platform=${TARGETPLATFORM:-linux/amd64} golang:1.18.4-alpine
RUN CGO_ENABLED=0 go build -trimpath -ldflags "$LDFLAGS" -o ./velox ./cmd/vx

FROM --platform=${TARGETPLATFORM:-linux/amd64} golang:1.18-alpine

# use same build arguments for image labels
ARG APP_VERSION="undefined"
Expand Down

0 comments on commit 9589198

Please sign in to comment.