-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (26 loc) · 970 Bytes
/
Copy pathDockerfile
File metadata and controls
39 lines (26 loc) · 970 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
38
39
# Build Stage
FROM rust:slim-bookworm as builder
# Install required build dependencies
RUN apt-get update && apt-get install -y pkg-config libssl-dev protobuf-compiler
WORKDIR /usr/src/app
# Copy the entire workspace
COPY . .
# Build the hub_server binary in release mode
RUN cargo build --release --bin hub_server
# Runtime Stage
FROM debian:bookworm-slim
# Install runtime dependencies (e.g. certificates for TLS)
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the compiled binary from the builder stage
COPY --from=builder /usr/src/app/target/release/hub_server /app/hub_server
# Create a default empty config directory
RUN mkdir -p /app/config && echo '{"skills":[]}' > /app/config/skills.json
# Ensure the binary is executable
RUN chmod +x /app/hub_server
# Set environment variables
ENV RUST_LOG=info
ENV HUB_CONFIG_DIR=/app/config
# Expose the API port
EXPOSE 3000
CMD ["/app/hub_server"]