27 lines
447 B
Docker
27 lines
447 B
Docker
FROM golang:1.26-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy Go files
|
|
COPY backend/go.mod backend/go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY backend ./backend
|
|
WORKDIR /app/backend
|
|
|
|
# Build the Go binary
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /server ./cmd/server
|
|
|
|
# Final stage
|
|
FROM alpine:latest
|
|
|
|
RUN apk --no-cache add ca-certificates tzdata
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /server ./server
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Run the server
|
|
CMD ["./server"] |