Skip to content

Commit

Permalink
Refactor Dockerfile to improve multi-stage build process and update b…
Browse files Browse the repository at this point in the history
…ase image

Signed-off-by: HAHWUL <[email protected]>
  • Loading branch information
hahwul committed Dec 7, 2024
1 parent fe02232 commit 694757b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# BUILDER
# === BUILDER ===
FROM golang:latest AS builder
WORKDIR /go/src/app
COPY . .

RUN go get -d -v ./...
# Install dependencies
COPY go.mod go.sum ./
RUN go mod download

# Copy the source code
COPY . .
RUN go build -o dalfox

# RUNNING
FROM debian:buster
# === RUNNER ===
FROM debian:bookworm
RUN mkdir /app

# Copy the binary from the builder stage
COPY --from=builder /go/src/app/dalfox /app/dalfox
COPY --from=builder /go/src/app/samples /app/samples

WORKDIR /app/
CMD ["/app/dalfox"]

0 comments on commit 694757b

Please sign in to comment.