-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (28 loc) · 810 Bytes
/
Dockerfile
File metadata and controls
38 lines (28 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
ARG GO_VERSION=1.25
ARG ALPINE_VERSION=3.22
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build
WORKDIR /app
COPY go.mod go.sum ./
RUN \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/go \
go mod download
COPY . .
ARG TARGETOS
ARG TARGETARCH
RUN \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/go \
GOOS=${TARGETOS} \
GOARCH=${TARGETARCH} \
CGO_ENABLED=0 \
go build \
-gcflags "all=-N -l" \
-o /app/bin/alexandria \
./cmd/alexandria
FROM alpine:${ALPINE_VERSION} AS run
WORKDIR /app
RUN apk -U add ca-certificates mailcap
COPY --from=build /app/bin/alexandria /app/bin/alexandria
CMD ["/app/bin/alexandria"]
LABEL org.opencontainers.image.source="https://github.com/TecharoHQ/alexandria"