Files
web-hosts/domains/coppertone.tech/backend/functions/llm-service/Containerfile
2025-12-26 13:38:04 +01:00

37 lines
641 B
Docker

# Build Stage
FROM golang:1.23-alpine AS build
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum* ./
# Download dependencies
RUN go mod download
# Copy source code
COPY *.go ./
# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o llm-service .
# Runtime Stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates curl
WORKDIR /root/
# Copy the binary from build stage
COPY --from=build /app/llm-service .
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Run the binary
CMD ["./llm-service"]