[FEAT] Docker compose

This commit is contained in:
2026-01-21 13:37:34 +01:00
parent 08a0e7b35d
commit 862368f1df
3 changed files with 91 additions and 0 deletions

38
Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
# Build stage
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Install git for fetching dependencies
RUN apk add --no-cache git
# Copy go mod files first for better caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -o fitra-backend .
# Runtime stage
FROM alpine:latest
WORKDIR /app
# Copy the binary from builder
COPY --from=builder /app/fitra-backend .
# Create uploads directory
RUN mkdir -p /app/uploads
# Expose port
EXPOSE 8080
# Set environment variables
ENV GIN_MODE=release
ENV PORT=8080
# Run the binary
CMD ["./fitra-backend"]