Add build-scripts with docker

main
Ruakij 2 years ago
parent ca1b66dc99
commit 34bfe19158

@ -0,0 +1,13 @@
# ---- Build ----
FROM golang:1.19-alpine AS build
WORKDIR /build
# Copy sources
ADD . .
# Get dependencies
RUN go get ./cmd/app
# Compile
RUN CGO_ENABLED=0 go build -a -o app ./cmd/app
# ---- Output ----
FROM scratch AS export-stage
COPY --from=build /build/app .

@ -0,0 +1,9 @@
PLATFORM="linux/amd64,linux/arm64/v8,linux/arm/v7"
EXTRA_ARGS="$@"
docker buildx build \
--platform $PLATFORM \
-f $(dirname $0)/Dockerfile \
--output out \
$EXTRA_ARGS \
.

@ -0,0 +1,7 @@
EXTRA_ARGS="$@"
docker build \
-f $(dirname $0)/Dockerfile \
--output out \
$EXTRA_ARGS \
.
Loading…
Cancel
Save