-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
52 lines (35 loc) · 1.06 KB
/
Containerfile
File metadata and controls
52 lines (35 loc) · 1.06 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
# Build stage
FROM golang:1.25-alpine AS builder
# Install build dependencies required for go-sqlite3
RUN apk add --no-cache gcc musl-dev
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the application
# CGO_ENABLED=1 is required for go-sqlite3
RUN CGO_ENABLED=1 go build -o soap-journal ./cmd/server
# Final stage
FROM alpine:latest
# Copy Litestream binary
COPY --from=docker.io/litestream/litestream:latest /usr/local/bin/litestream /usr/local/bin/litestream
WORKDIR /app
# Install runtime dependencies
RUN apk add --no-cache ca-certificates sqlite bash curl
# Copy binary from builder
COPY --from=builder /app/soap-journal .
# Copy entrypoint script
COPY scripts/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Copy Litestream config
COPY litestream.yml /etc/litestream.yml
# Expose port
EXPOSE 8080
# Set environment variable for port
ENV PORT=8080
# Create directory for database
RUN mkdir -p /data
# Run the application via entrypoint
ENTRYPOINT ["/app/entrypoint.sh"]