modified: Dockerfile
new file: go.sum add go.sum file in hadle mod
This commit is contained in:
@@ -1,23 +1,14 @@
|
|||||||
# Use official Go image with specific version
|
# Build stage
|
||||||
FROM golang:1.25.1
|
FROM golang:1.25.1 as builder
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy Go module files first
|
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
|
|
||||||
# Download dependencies
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
# Copy source code
|
|
||||||
COPY *.go ./
|
COPY *.go ./
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/app
|
||||||
|
|
||||||
# Build the binary
|
# Final stage
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
|
FROM gcr.io/distroless/static-debian12
|
||||||
|
WORKDIR /
|
||||||
# Expose port
|
COPY --from=builder /go/bin/app /app
|
||||||
EXPOSE 8080
|
CMD ["/app"]
|
||||||
|
EXPOSE 8080
|
||||||
# Run the application
|
|
||||||
CMD ["./main"]
|
|
||||||
Reference in New Issue
Block a user