44 lines
922 B
Docker

# Provider Daemon Dockerfile
FROM golang:1.23-alpine AS builder
# Install git and ca-certificates
RUN apk add --no-cache git ca-certificates
# Set working directory
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 provider-daemon ./cmd/daemon
# Final stage
FROM alpine:latest
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates curl
WORKDIR /root/
# Copy the binary from builder stage
COPY --from=builder /app/provider-daemon .
# Copy config files
COPY --from=builder /app/configs ./configs
# Expose port
EXPOSE 8085
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8085/health || exit 1
# Run the binary
CMD ["./provider-daemon"]