-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (35 loc) · 974 Bytes
/
Dockerfile
File metadata and controls
46 lines (35 loc) · 974 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
39
40
41
42
43
44
45
46
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETOS
ARG TARGETARCH
ARG TARGETPLATFORM
# Build the manager binary
FROM golang:1.25 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# Download all dependencies and verify
RUN go mod download
RUN go mod verify
# Copy the go source
COPY api/ api/
COPY cmd/ cmd/
COPY internal/ internal/
# Build
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build --ldflags "-s -w" -a -o lvms cmd/main.go
FROM --platform=$TARGETPLATFORM fedora:latest
RUN dnf update -y && \
dnf install --nodocs --noplugins -y \
util-linux \
e2fsprogs \
xfsprogs \
glibc && \
dnf clean all
RUN [ -d /run/lock ] || mkdir /run/lock
WORKDIR /
COPY --from=builder /workspace/lvms .
RUN mkdir /licenses
COPY LICENSE /licenses
USER 65532:65532
# '/lvms' is the entrypoint for all LVMS binaries
ENTRYPOINT ["/lvms"]