# Use the Go image for building FROM golang:1.21-alpine AS builder WORKDIR /app # Install dependencies RUN apk add --no-cache gcc musl-dev sqlite sqlite-dev # Copy source code and Go module files COPY go.mod go.sum ./ RUN go mod download COPY . . # Build the application RUN CGO_ENABLED=1 GOOS=linux go build -o app # Use a minimal image for the final stage FROM alpine:latest WORKDIR /app RUN apk add --no-cache gcc musl-dev sqlite sqlite-dev # Copy the compiled app and necessary files from the builder stage COPY --from=builder /app/app . #COPY --from=builder /app/data /data # Set environment variables ENV DB_PATH=/data/admin.db # Expose the application port EXPOSE 8080 # Command to run the application CMD ["./app"]