first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:37:58 +03:00
commit 8b1fbdee99
104 changed files with 23398 additions and 0 deletions

43
Dockerfile Normal file
View File

@@ -0,0 +1,43 @@
# Build Stage
FROM golang:1.25.6-alpine AS builder
WORKDIR /app
# Install build dependencies including libwebp
RUN apk add --no-cache git gcc musl-dev libwebp-dev
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Fix missing entries in go.sum (run after COPY to fix overwritten files)
RUN go mod tidy
RUN k=$(ls -la) && echo "$k"
# Install swag
RUN go install github.com/swaggo/swag/cmd/swag@latest
# Generate swagger docs
RUN swag init
# Build the binary with CGO enabled for WebP support
RUN CGO_ENABLED=1 GOOS=linux go build -a -ldflags '-linkmode external -extldflags "-static"' -o main .
# Run Stage
FROM alpine:latest
WORKDIR /app
# Install runtime dependencies: CA certificates and libwebp
RUN apk --no-cache add ca-certificates libwebp
COPY --from=builder /app/main .
COPY --from=builder /app/.env .
COPY --from=builder /app/web ./web
COPY --from=builder /app/docs ./docs
# Note: .env might be overridden by docker-compose environment
EXPOSE 8080
CMD ["./main"]