Files
manage-servers/Dockerfile
T
Matthias Hinrichs f9b519c343
Build And Test / build (push) Successful in 17s
Build And Test / publish (push) Failing after 2m11s
fix: kommentiere den COPY-Befehl für servers.json im Dockerfile aus
2025-11-21 23:30:59 +01:00

40 lines
909 B
Docker

# Stage 1: Builder
FROM golang:1.25.4-alpine AS builder
WORKDIR /app
# Copy go.mod and go.sum first to leverage Docker cache
COPY go.mod .
COPY go.sum .
# Download dependencies
RUN go mod download
# Copy the rest of the application source code
COPY . .
# Build the application
# CGO_ENABLED=0 is important for static linking, resulting in a smaller image
# -o manage-servers specifies the output binary name
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o manage-servers .
# Stage 2: Runner
FROM alpine:latest
WORKDIR /root/
# Copy the compiled binary from the builder stage
COPY --from=builder /app/manage-servers .
# Copy the index.html file for the web server
COPY --from=builder /app/index.html .
# Copy the servers.json file
# COPY servers.json .
# Expose the port the web server listens on
EXPOSE 8080
# Command to run the application
ENTRYPOINT ["./manage-servers", "serve"]