Skip to content

Commit fb1819b

Browse files
authored
Merge pull request #606 from hahwul/improve-dockerfile
Refactor Dockerfile to improve multi-stage build process and update base image
2 parents fe02232 + 694757b commit fb1819b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Dockerfile

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1-
# BUILDER
1+
# === BUILDER ===
22
FROM golang:latest AS builder
33
WORKDIR /go/src/app
4-
COPY . .
54

6-
RUN go get -d -v ./...
5+
# Install dependencies
6+
COPY go.mod go.sum ./
7+
RUN go mod download
8+
9+
# Copy the source code
10+
COPY . .
711
RUN go build -o dalfox
812

9-
# RUNNING
10-
FROM debian:buster
13+
# === RUNNER ===
14+
FROM debian:bookworm
1115
RUN mkdir /app
16+
17+
# Copy the binary from the builder stage
1218
COPY --from=builder /go/src/app/dalfox /app/dalfox
1319
COPY --from=builder /go/src/app/samples /app/samples
20+
1421
WORKDIR /app/
1522
CMD ["/app/dalfox"]

0 commit comments

Comments
 (0)