31 lines
453 B
Plaintext
31 lines
453 B
Plaintext
# Build stage
|
|
FROM golang:1.23-alpine AS builder
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files
|
|
COPY go.* ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the binary
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o main .
|
|
|
|
# Final stage
|
|
FROM alpine:latest
|
|
|
|
RUN apk --no-cache add ca-certificates tzdata
|
|
|
|
WORKDIR /root/
|
|
|
|
# Copy the binary from the build stage
|
|
COPY --from=builder /app/main .
|
|
|
|
EXPOSE 8090
|
|
|
|
CMD ["./main"]
|