-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (41 loc) · 1.24 KB
/
Dockerfile
File metadata and controls
58 lines (41 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
# Build stage
FROM rust:1.92-slim-bookworm as builder
WORKDIR /workspace
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifest files
COPY Cargo.toml Cargo.lock* ./
# Copy source code
COPY src ./src
# Build the application in release mode
RUN cargo build --release
# Runtime stage
FROM debian:bookworm-slim
WORKDIR /workspace
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary from builder
COPY --from=builder /workspace/target/release/openheim /usr/local/bin/openheim
# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Create a non-root user with home directory for config
RUN useradd -m -u 1000 openheim && \
chown -R openheim:openheim /workspace
USER openheim
# Create config directory (will be used if no volume mounted)
RUN mkdir -p /home/openheim/.openheim
# Expose the API port
EXPOSE 1217
# Set environment variables
ENV RUST_LOG=info
ENTRYPOINT ["docker-entrypoint.sh"]
# Default to API mode
CMD ["openheim", "serve"]