update
This commit is contained in:
16
Dockerfile
16
Dockerfile
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user