-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (32 loc) · 1010 Bytes
/
Dockerfile
File metadata and controls
44 lines (32 loc) · 1010 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
# Stage 1: Build the binary
FROM golang:1.25 AS builder
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ ./cmd/
COPY internal/ ./internal/
COPY web/ ./web/
COPY bootloaders/ ./bootloaders/
COPY main.go .
ARG VERSION=dev
ARG TARGETOS=linux
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
-a -ldflags="-w -s -X bootimus/internal/server.Version=${VERSION}" \
-o /out/bootimus-${TARGETOS}-${TARGETARCH} .
# Alias for runtime stage
RUN cp /out/bootimus-${TARGETOS}-${TARGETARCH} /out/bootimus
# Stage for exporting binaries only
FROM scratch AS binaries
COPY --from=builder /out/ /
# Stage 2: Runtime
FROM debian:trixie-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
wimtools samba ca-certificates libarchive-tools \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /out/bootimus /bootimus
EXPOSE 69/udp 8080/tcp 8081/tcp 10809/tcp 445/tcp
USER root
VOLUME [ "/data" ]
ENTRYPOINT ["/bootimus"]
CMD ["serve"]