Skip to content

Commit 4034bdd

Browse files
Yordan Miladinovydm
authored andcommitted
Docker image now runs as non-root
1 parent d65d507 commit 4034bdd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1
2-
FROM golang:1.24 as builder
2+
FROM golang:1.24 AS builder
33
ARG VERSION
44
WORKDIR /build
55

@@ -8,16 +8,18 @@ COPY go.sum ./
88

99
RUN go mod download
1010

11-
ADD . .
11+
COPY . .
1212
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 GOOS=linux go build \
1313
-trimpath \
1414
-v \
1515
-ldflags "-w -s -X 'github.com/flashbots/mev-boost/config.Version=$VERSION'" \
1616
-o mev-boost .
1717

18-
FROM alpine
19-
WORKDIR /app
18+
FROM alpine:3
2019
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
2120
COPY --from=builder /build/mev-boost /app/mev-boost
21+
WORKDIR /app
2222
EXPOSE 18550
23+
RUN adduser -D mev
24+
USER mev
2325
ENTRYPOINT ["/app/mev-boost"]

0 commit comments

Comments
 (0)