Files
ClubLogos/backend/Dockerfile
T
Tomáš Dvořák 0fc92f8464 first commit
2025-10-02 12:39:28 +02:00

37 lines
608 B
Docker

# Build stage
FROM golang:1.21-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache gcc musl-dev sqlite-dev
# Copy go mod files
COPY go.mod go.sum* ./
RUN go mod download
# Copy source code
COPY . .
# Build the application
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o main .
# Runtime stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates sqlite-libs
WORKDIR /root/
# Copy the binary from builder
COPY --from=builder /app/main .
# Create directories
RUN mkdir -p /root/logos
# Expose port
EXPOSE 8080
# Run the application
CMD ["./main"]