-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
130 lines (109 loc) · 4.36 KB
/
Copy pathDockerfile
File metadata and controls
130 lines (109 loc) · 4.36 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Build stage - contains build dependencies
FROM python:3.13-slim-bookworm AS builder
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
UV_VERSION=0.9.7 \
VIBE_TRADING_HOME=/opt/vibe-trading \
VIBE_TRADING_AGENT_DIR=/usr/local/lib/python3.13/site-packages
WORKDIR /app
# Install build dependencies (removed git - not needed)
# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
curl \
gcc \
g++ \
pkg-config \
libssl-dev \
libffi-dev \
libpq-dev \
libsqlite3-dev \
ca-certificates \
gnupg \
&& rm -rf /var/lib/apt/lists/*
# Ensure critical system libraries are upgraded to patched versions
# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -y --only-upgrade libgnutls30 libgcrypt20 || true && \
rm -rf /var/lib/apt/lists/*
# Install uv and Python packages as wheels
# hadolint ignore=DL3013
RUN pip install --no-cache-dir "uv==${UV_VERSION}" && \
pip install --no-cache-dir vibe-trading-ai
# Copy and install application
COPY pyproject.toml README.md ./
COPY src/ src/
RUN uv pip install --system -e . --no-cache
# Note: workspace-mcp is installed at runtime via bind mount to /opt/workspace-mcp
# Runtime stage - minimal image with only runtime dependencies
FROM python:3.13-slim-bookworm
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
VIBE_TRADING_HOME=/opt/vibe-trading \
VIBE_TRADING_AGENT_DIR=/usr/local/lib/python3.13/site-packages
WORKDIR /app
# Install ONLY runtime dependencies
# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
supervisor \
libpq5 \
libsqlite3-0 \
gnupg \
&& rm -rf /var/lib/apt/lists/* && \
apt-get autoremove -y && \
apt-get clean
# Upgrade critical system libraries in runtime image to patched versions
# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -y --only-upgrade libgnutls30 libgcrypt20 || true && \
rm -rf /var/lib/apt/lists/*
# Install Node.js 20 (LTS) for opencode-ai runtime
# hadolint ignore=DL3008
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key -o /tmp/nodesource.gpg && \
gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg /tmp/nodesource.gpg && \
rm -f /tmp/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/* && \
apt-get autoremove -y && \
apt-get clean
# Install opencode-ai globally via npm (needed at runtime)
# hadolint ignore=DL3016
RUN npm install -g opencode-ai && \
npm cache clean --force
# Copy Python packages and application from builder
COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /app /app
# Copy OpenCode configuration
COPY docs/config.json /etc/opencode/config.json
# Create appuser and setup permissions
RUN useradd --create-home --shell /bin/bash appuser && \
mkdir -p /home/appuser/.config/opencode /home/appuser/.vibe-trading /home/appuser/.cache/uv/wheels-v5 /home/appuser/.cache/uv/simple-v18 /opt/vibe-trading /var/log/supervisor /home/appuser/OpenBBUserData/cache/openbb_akshare /app/.venv && \
cp /etc/opencode/config.json /home/appuser/.config/opencode/config.json && \
chown -R appuser:appuser /app /home/appuser ${VIBE_TRADING_AGENT_DIR} /opt/vibe-trading /var/log/supervisor && \
chmod -R 777 /app/.venv
# Create MCP configuration file for agents
RUN cat > /home/appuser/.mcp.json << 'EOF'
{
"mcpServers": {
"workspace_mcp": {
"type": "http",
"url": "http://127.0.0.1:8787/mcp"
}
}
}
EOF
# Copy remaining files
COPY docs/equity.db /home/appuser/OpenBBUserData/cache/openbb_akshare/equity.db
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chown appuser:appuser /home/appuser/OpenBBUserData/cache/openbb_akshare/equity.db
EXPOSE 8001 4096 8899 8787
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]