forked from lemonade-sdk/lemonade
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
75 lines (61 loc) · 2.03 KB
/
Dockerfile
File metadata and controls
75 lines (61 loc) · 2.03 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
67
68
69
70
71
72
73
74
75
# ==============================================================
# # 1. Build stage — compile lemonade C++ binaries
# # ============================================================
FROM ubuntu:24.04 AS builder
# Avoid interactive prompts during build
ENV DEBIAN_FRONTEND=noninteractive
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
ninja-build \
libssl-dev \
pkg-config \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy source code
COPY . /app
WORKDIR /app
# Build the project
RUN rm -rf build && \
cmake --preset default && \
cmake --build --preset default
# Debug: Check build outputs
RUN echo "=== Build directory contents ===" && \
ls -la build/ && \
echo "=== Checking for resources ===" && \
find build/ -name "*.json" -o -name "resources" -type d
# # ============================================================
# # 2. Runtime stage — small, clean image
# # ============================================================
FROM ubuntu:24.04
# Install runtime dependencies only
RUN apt-get update && apt-get install -y \
libcurl4 \
curl \
libssl3 \
zlib1g \
vulkan-tools \
libvulkan1 \
unzip \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Create application directory
WORKDIR /opt/lemonade
# Copy built executables and resources from builder
COPY --from=builder /app/build/lemonade-router ./lemonade-router
COPY --from=builder /app/build/lemonade-server ./lemonade-server
COPY --from=builder /app/build/resources ./resources
# Make executables executable
RUN chmod +x ./lemonade-router ./lemonade-server
# Create necessary directories
RUN mkdir -p /opt/lemonade/llama/cpu \
/opt/lemonade/llama/vulkan \
/root/.cache/huggingface
# Expose default port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/live || exit 1
# Default command: start server in headless mode
CMD ["./lemonade-server", "serve", "--no-tray", "--host", "0.0.0.0"]