update
This commit is contained in:
16
Dockerfile
16
Dockerfile
@@ -7,17 +7,17 @@ RUN apk add --no-cache git
|
|||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy go mod files
|
# Copy go mod files from src directory
|
||||||
COPY go.mod go.sum ./
|
COPY src/go.mod src/go.sum ./
|
||||||
|
|
||||||
# Download dependencies
|
# Download dependencies
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code from src directory
|
||||||
COPY . .
|
COPY src/ .
|
||||||
|
|
||||||
# Build the application
|
# 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
|
# Production stage
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
@@ -28,13 +28,13 @@ RUN apk --no-cache add ca-certificates
|
|||||||
WORKDIR /root/
|
WORKDIR /root/
|
||||||
|
|
||||||
# Copy binary from builder
|
# Copy binary from builder
|
||||||
COPY --from=builder /app/stats-api .
|
COPY --from=builder /app/serverstatistics .
|
||||||
|
|
||||||
# Copy config file
|
# Copy config file
|
||||||
COPY --from=builder /app/etc/stats-api.yaml ./etc/
|
COPY --from=builder /app/etc/serverstatistics.yaml ./etc/
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
CMD ["./stats-api"]
|
CMD ["./serverstatistics", "-f", "etc/serverstatistics.yaml"]
|
||||||
|
|||||||
Reference in New Issue
Block a user