-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (42 loc) · 1.4 KB
/
Dockerfile
File metadata and controls
58 lines (42 loc) · 1.4 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
# Build stage
FROM rust:latest AS builder
WORKDIR /app
# Install protobuf compiler for gRPC
RUN apt-get update && apt-get install -y protobuf-compiler && rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml Cargo.lock ./
COPY build.rs ./
COPY proto ./proto
COPY benches ./benches
# Create dummy src to cache dependencies
RUN mkdir -p src/bin && \
echo "fn main() {}" > src/main.rs && \
echo "fn main() {}" > src/bin/prefixdctl.rs && \
echo "" > src/lib.rs
# Build dependencies only (skip benchmarks for faster builds)
RUN cargo build --release --bins && rm -rf src
# Copy actual source code
COPY src ./src
COPY migrations ./migrations
# Build the application
RUN touch src/lib.rs src/main.rs src/bin/prefixdctl.rs && \
cargo build --release --bins
# Runtime stage - use same base as rust image for glibc compatibility
FROM debian:trixie-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy binaries
COPY --from=builder /app/target/release/prefixd /usr/local/bin/
COPY --from=builder /app/target/release/prefixdctl /usr/local/bin/
# Copy migrations (needed for postgres)
COPY --from=builder /app/migrations ./migrations
# Create data directory
RUN mkdir -p /data /etc/prefixd
# Default config directory
ENV PREFIXD_CONFIG=/etc/prefixd
EXPOSE 8080 9090
ENTRYPOINT ["prefixd"]
CMD ["--config", "/etc/prefixd"]