# Backend Dockerfile for hiling_go FROM golang:1.20-alpine AS builder # Install build dependencies RUN apk add --no-cache git WORKDIR /app # Copy go mod files COPY hiling_go/go.mod hiling_go/go.sum ./ # Download dependencies RUN go mod download # Copy source code COPY hiling_go/ ./ # Build the application RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . # Production stage FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /root/ # Copy the binary from builder COPY --from=builder /app/main . # Copy public directory if it exists COPY --from=builder /app/public ./public # Expose port EXPOSE 8888 # Run the binary CMD ["./main"]