-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.api
More file actions
45 lines (33 loc) · 933 Bytes
/
Dockerfile.api
File metadata and controls
45 lines (33 loc) · 933 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
40
41
42
43
44
45
# Build stage
FROM rust:latest as builder
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy the entire project
COPY . .
# Build the API in release mode
RUN cargo build --release -p zerch-api
# Runtime stage
FROM ubuntu:24.04
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary from builder
COPY --from=builder /app/target/release/zerch-api /usr/local/bin/zerch-api
# Create cache directory for HuggingFace models
RUN mkdir -p /root/.cache/huggingface
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Run the API
CMD ["zerch-api"]