Files
mdhost/Dockerfile
T
Florian.Walther e215b1d3b6
Docker Release Build / push_to_registry (push) Successful in 54s
added footer and app_version
2026-05-02 16:04:54 +02:00

26 lines
513 B
Docker

FROM golang:1.26-alpine AS builder
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build statically with version
ARG APP_VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s -X main.version=${APP_VERSION}" -o mdhost .
# Final scratch image
FROM scratch
# Copy binary from builder
COPY --from=builder /app/mdhost /mdhost
# Run the application - directories will be bind-mounted from host
CMD ["/mdhost"]