mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 10:42:57 +00:00
36 lines
585 B
Docker
36 lines
585 B
Docker
# Build stage
|
|
FROM golang:1.24.5-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies
|
|
RUN apk add --no-cache git
|
|
|
|
# Download dependencies
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o fotbal-club
|
|
|
|
# Final stage
|
|
FROM alpine:latest
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy the binary from builder
|
|
COPY --from=builder /app/fotbal-club .
|
|
|
|
# Copy templates and static files if any
|
|
COPY ./templates ./templates
|
|
COPY ./static ./static
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Command to run the executable
|
|
CMD ["./fotbal-club"]
|