Files
roadwave/backend/Dockerfile
2026-01-31 11:45:11 +01:00

34 lines
553 B
Docker

# Builder stage
FROM golang:1.23-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags="-w -s" -o /bin/api ./cmd/api
# Final stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates ffmpeg
WORKDIR /root/
# Copy binary from builder
COPY --from=builder /bin/api .
# Copy config files
COPY config/ ./config/
EXPOSE 8080
CMD ["./api"]