-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
92 lines (76 loc) · 2.16 KB
/
Dockerfile
File metadata and controls
92 lines (76 loc) · 2.16 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Multi-stage Docker build for Conch Cross-Platform Project
# Stage 1: Build environment
FROM ubuntu:22.04 AS builder
# Install build dependencies and Qt system requirements
RUN apt-get update && apt-get install -y \
build-essential \
ninja-build \
git \
python3 \
python3-pip \
wget \
curl \
libgl1-mesa-dev \
pkg-config \
xkb-data \
libxkbcommon-x11-0 \
libxkbcommon-dev \
libxcb-xkb1 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-sync1 \
libxcb-xfixes0 \
libxcb-xinerama0 \
libxcb1 \
libfontconfig1 \
libdbus-1-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Install CMake 3.28 (required version >= 3.25)
RUN wget https://github.com/Kitware/CMake/releases/download/v3.28.0/cmake-3.28.0-linux-x86_64.sh -O /tmp/cmake.sh \
&& chmod +x /tmp/cmake.sh \
&& /tmp/cmake.sh --skip-license --prefix=/usr/local \
&& rm /tmp/cmake.sh
# Install Conan
RUN pip3 install conan
# Set working directory
WORKDIR /app
# Copy project files
COPY . .
# Create build directory and navigate into it
RUN mkdir -p build
# Create Conan default profile
RUN conan profile detect --force
# Install Conan dependencies (no sudo needed in Docker as root user)
WORKDIR /app/build
RUN conan install .. \
--build=missing \
-c tools.system.package_manager:mode=install \
-c tools.system.package_manager:sudo=False
# Configure CMake with Conan toolchain (matching build.sh)
RUN cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=Release/generators/conan_toolchain.cmake
# Build the project
RUN cmake --build . --config Release -j$(nproc)
# Stage 2: Runtime environment (minimal)
FROM ubuntu:22.04 AS runtime
# Install only runtime dependencies
RUN apt-get update && apt-get install -y \
libstdc++6 \
libgl1 \
libglib2.0-0 \
libdbus-1-3 \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 conchuser
# Copy binaries from builder
COPY --from=builder /app/build/bin/* /usr/local/bin/
# Switch to non-root user
USER conchuser
# Default command
CMD ["trading_engine"]