Skip to content

Commit

Permalink
multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshjosh361 committed Oct 10, 2024
1 parent 9873988 commit 7d855ce
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions notification-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# First stage: Build the Go binary
FROM golang:1.22.2-alpine AS builder

WORKDIR /app

# Copy go.mod and go.sum to cache dependencies
COPY go.mod ./
COPY go.sum ./
RUN go mod download

# Copy the rest of the application files
COPY . .

# Build the Go app as a statically linked binary
Expand All @@ -22,8 +19,7 @@ WORKDIR /root/
# Copy the Go binary from the builder stage
COPY --from=builder /app/main .

# Expose port 8084

EXPOSE 8084

# Run the Go binary
CMD ["./main"]

0 comments on commit 7d855ce

Please sign in to comment.