Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions dhcp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:1.26 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /bootz-dhcp ./dhcp/main

FROM gcr.io/distroless/static-debian12
COPY --from=builder /bootz-dhcp /bootz-dhcp
# DHCP needs to run as root to bind to port 67 and use raw sockets.
# hadolint ignore=DL3002
USER nonroot
ENTRYPOINT ["/bootz-dhcp"]

17 changes: 17 additions & 0 deletions http/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:1.26 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /bootz-http ./http/main

FROM gcr.io/distroless/static-debian12
WORKDIR /www
COPY --from=builder /bootz-http /bootz-http
# HTTP server might need to run as root to bind to port 80.
# hadolint ignore=DL3002
USER nonroot
ENTRYPOINT ["/bootz-http"]
Comment on lines +11 to +14
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Running the HTTP server as root is generally discouraged for security reasons. It is recommended to run as a non-privileged user (like the nonroot user provided by distroless) and bind to a non-privileged port (e.g., 8080). The port mapping to 80 can be handled by the container runtime or orchestrator.

# HTTP server should run as non-root for better security.
USER nonroot
ENTRYPOINT ["/bootz-http"]
CMD ["-address", ":8080"]

CMD ["-address", ":8080"]


Loading