Files
wagfarm/wagfarm-api/Dockerfile
2025-04-17 15:22:55 +02:00

26 lines
467 B
Docker

# Stage 1: Build the Go binary
FROM golang:1.21-alpine AS builder
WORKDIR /app
# Copy go.mod and go.sum first
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the code
COPY . .
# Build the Go binary
RUN go build -o wagfarm-api main.go
# Stage 2: Minimal runtime image
FROM alpine:latest
WORKDIR /root/
# Copy the binary from the builder
COPY --from=builder /app/wagfarm-api .
# Run the binary
CMD ["./wagfarm-api"]
#CMD ["tail", "-f", "/dev/null"]