Skip to content

Commit

Permalink
Merge pull request #606 from hahwul/improve-dockerfile
Browse files Browse the repository at this point in the history
Refactor Dockerfile to improve multi-stage build process and update base image
  • Loading branch information
hahwul authored Dec 7, 2024
2 parents fe02232 + 694757b commit fb1819b
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 fb1819b

Please sign in to comment.