-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (47 loc) · 1.24 KB
/
Dockerfile
File metadata and controls
66 lines (47 loc) · 1.24 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Arc - High-Performance Time-Series Database (Go)
# Multi-stage build for minimal image size
ARG VERSION=dev
# Build stage
FROM golang:1.26-bookworm AS builder
WORKDIR /build
# Copy go mod files first for better layer caching
COPY go.mod go.sum ./
RUN go mod download && go mod verify
# Copy source code
COPY . .
# Build
ARG VERSION
RUN go build -v \
-tags=duckdb_arrow \
-ldflags="-s -w -X main.Version=${VERSION}" \
-o arc ./cmd/arc
# Production stage
FROM debian:bookworm-slim
ARG VERSION
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 arc && \
mkdir -p /app/data && \
chown -R arc:arc /app
WORKDIR /app
# Copy binary from builder
COPY --from=builder --chown=arc:arc /build/arc .
# Copy default config
COPY --chown=arc:arc arc.toml .
# Create VERSION file
RUN echo "${VERSION}" > VERSION && chown arc:arc VERSION
# Switch to non-root user
USER arc
# Data volume
VOLUME ["/app/data"]
# Expose API port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Run Arc
ENTRYPOINT ["./arc"]