Files
counter/Dockerfile
aovantsev 0dcb5d9b87
Some checks reported errors
continuous-integration/drone/push Build encountered an error
init
2025-10-02 22:30:16 +03:00

34 lines
548 B
Docker

# Build stage
FROM golang:1.21-alpine AS builder
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
# Final stage
FROM alpine:latest
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates
WORKDIR /root/
# Copy the binary from builder stage
COPY --from=builder /app/main .
# Expose port
EXPOSE 8080
# Run the binary
CMD ["./main"]