-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (24 loc) · 827 Bytes
/
Dockerfile
File metadata and controls
37 lines (24 loc) · 827 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
# Build stage
FROM golang:1.26-alpine AS builder
RUN apk add --no-cache gcc musl-dev
WORKDIR /app
# Copy dependency files first for better caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the binary with CGO enabled (required for go-sqlite3)
RUN CGO_ENABLED=1 go build -o /app/focusd ./cmd/main.go
# Runtime stage
FROM alpine:3.21
RUN apk add --no-cache ca-certificates
WORKDIR /app
COPY --from=builder /app/focusd .
# Create an empty .env so godotenv.Load() doesn't fail
# All config is passed via environment variables instead
RUN touch .env
ENV PORT=8080
EXPOSE 8080
# TURSO_CONNECTION_PATH and TURSO_CONNECTION_TOKEN must be provided at runtime
# e.g. docker run -e TURSO_CONNECTION_PATH=... -e TURSO_CONNECTION_TOKEN=... focusd
CMD ["./focusd", "serve", "--port", "8080"]