Files
MrixsCraft-server/Dockerfile
Vladimir Zagainov 3e4b97e262
All checks were successful
CI / lint (push) Successful in 19s
CI / test (push) Successful in 19s
CI / build (push) Successful in 18s
CI / docker (push) Successful in 1m12s
fix: update builder image to golang:1.25-alpine
go.mod requires Go 1.25+, but Dockerfile was still using golang:1.22-alpine
as the builder image. This caused CI build failure:
  "go.mod requires go >= 1.25.0 (running go 1.22.12)"
2026-06-01 17:20:51 +03:00

20 lines
495 B
Docker

# Multi-stage build for MrixsCraft backend.
# Final image: ~20 MB, non-root, no toolchain.
FROM golang:1.25-alpine AS builder
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /mc-backend ./cmd/server
FROM alpine:3.19
RUN apk --no-cache add ca-certificates
RUN adduser -D -g '' appuser
WORKDIR /app
COPY --from=builder /mc-backend .
COPY ./migrations /migrations
USER appuser
EXPOSE 8080
ENTRYPOINT ["/app/mc-backend"]