Use buildx

This commit is contained in:
Ian Fijolek
2024-04-03 12:15:11 -07:00
parent f58b4c1495
commit 7604138c9e
5 changed files with 18 additions and 79 deletions
+5 -5
View File
@@ -1,4 +1,3 @@
ARG REPO=library
FROM golang:1.20 AS builder
RUN mkdir /app
@@ -9,12 +8,13 @@ RUN go mod download
COPY ./*.go /app/
ARG ARCH=amd64
ARG TARGETOS
ARG TARGETARCH
ARG VERSION=dev
ENV CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH}
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=${TARGETARCH}
RUN go build -ldflags "-X main.version=${VERSION}" -a -installsuffix nocgo -o minitor .
FROM ${REPO}/alpine:3.18
FROM alpine:3.18
RUN mkdir /app
WORKDIR /app/
@@ -22,7 +22,7 @@ WORKDIR /app/
COPY --from=builder /app/minitor .
# Add common checking tools
RUN apk --no-cache add bash=~5 curl=~8 jq=~1 bind-tools=~9 tzdata~=2023c
RUN apk --no-cache add bash=~5 curl=~8 jq=~1 bind-tools=~9 tzdata~=2024a
# Add minitor user for running as non-root
RUN addgroup -S minitor && adduser -S minitor -G minitor