-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.api
More file actions
39 lines (26 loc) · 781 Bytes
/
Dockerfile.api
File metadata and controls
39 lines (26 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Dockerfile for Fayan API
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git gcc musl-dev sqlite-dev
WORKDIR /build
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the API binary with FTS5 enabled
RUN CGO_ENABLED=1 CGO_CFLAGS="-DSQLITE_ENABLE_FTS5" GOOS=linux go build -a -installsuffix cgo -o /build/fayan-api ./cmd/api/main.go
# Final stage
FROM alpine:latest
# Install runtime dependencies
RUN apk add --no-cache ca-certificates sqlite-libs
WORKDIR /app
# Copy binary from builder
COPY --from=builder /build/fayan-api .
# Copy config file
COPY config.yaml .
# Create data directory
RUN mkdir -p /app/data
# Expose API port (adjust if needed)
EXPOSE 8080
CMD ["./fayan-api"]