# Stage 1: Build the Go application FROM golang:1.22.3 AS builder # Set the working directory in the container WORKDIR /app # Copy the Go source code to the container COPY . . # Download necessary Go modules RUN go mod download # Build the application with CGO disabled for a static binary RUN CGO_ENABLED=0 GOOS=linux go build -o airbyte-clickhouse-normer . # Stage 2: Create a lightweight image with the Go binary FROM alpine:latest # Set the working directory in the container WORKDIR /app # Copy the binary from the builder stage COPY --from=builder /app/airbyte-clickhouse-normer . # Ensure binary has execute permissions RUN chmod +x airbyte-clickhouse-normer # Expose the port the app runs on (replace 8080 with your port) EXPOSE 8080 # Set the command to run the application CMD ["./airbyte-clickhouse-normer"]