Multi-platform dockerfile
This commit is contained in:
parent
51a1117950
commit
7b4bb1e36a
1 changed files with 11 additions and 7 deletions
18
Dockerfile
18
Dockerfile
|
@ -1,13 +1,17 @@
|
|||
FROM chimeralinux/chimera:latest AS base
|
||||
RUN apk add go
|
||||
|
||||
FROM base AS builder
|
||||
FROM chimeralinux/chimera:latest as base
|
||||
FROM base as builder
|
||||
WORKDIR /app
|
||||
RUN apk add go
|
||||
COPY . .
|
||||
RUN go build -ldflags "-s -w" -o diodemail -buildmode=pie ./cmd/server
|
||||
ARG TARGETPLATFORM
|
||||
RUN if [ $TARGETPLATFORM == "linux/riscv64" ]; then \
|
||||
apk add clang; \
|
||||
CGO_ENABLED=1 go build -ldflags="-s -w" -o diodemail -buildmode=pie ./cmd/server; \
|
||||
else \
|
||||
go build -ldflags="-s -w" -o diodemail -buildmode=pie ./cmd/server; \
|
||||
fi
|
||||
|
||||
FROM base AS runner
|
||||
FROM base as runner
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/diodemail ./diodemail
|
||||
|
||||
CMD ["./diodemail"]
|
||||
|
|
Loading…
Reference in a new issue