This commit is contained in:
2025-10-04 15:31:26 +08:00
parent 8c5c36fbdf
commit 5bad97badc

View File

@@ -7,17 +7,17 @@ RUN apk add --no-cache git
# Set working directory
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
# Copy go mod files from src directory
COPY src/go.mod src/go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Copy source code from src directory
COPY src/ .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o stats-api stats.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o serverstatistics serverstatistics.go
# Production stage
FROM alpine:latest
@@ -28,13 +28,13 @@ RUN apk --no-cache add ca-certificates
WORKDIR /root/
# Copy binary from builder
COPY --from=builder /app/stats-api .
COPY --from=builder /app/serverstatistics .
# Copy config file
COPY --from=builder /app/etc/stats-api.yaml ./etc/
COPY --from=builder /app/etc/serverstatistics.yaml ./etc/
# Expose port
EXPOSE 8888
# Run the application
CMD ["./stats-api"]
CMD ["./serverstatistics", "-f", "etc/serverstatistics.yaml"]