forked from chriswritescode-dev/opencode-manager
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
168 lines (127 loc) · 4.63 KB
/
Dockerfile
File metadata and controls
168 lines (127 loc) · 4.63 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
FROM node:20 AS base
ARG TARGETARCH
ARG INCLUDE_TTS=true
RUN apt-get update && apt-get install -y \
git \
curl \
lsof \
ripgrep \
ca-certificates \
grep \
gawk \
sed \
findutils \
coreutils \
procps \
jq \
less \
tree \
file \
python3 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
# Install kubectl (supports both amd64 and arm64)
RUN ARCH=$(case ${TARGETARCH} in arm64) echo "arm64" ;; *) echo "amd64" ;; esac) && \
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${ARCH}/kubectl" && \
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
rm kubectl
RUN curl -fsSL https://bun.sh/install | bash && \
mv /root/.bun /opt/bun && \
chmod -R 755 /opt/bun && \
ln -s /opt/bun/bin/bun /usr/local/bin/bun
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
mv /root/.local/bin/uv /usr/local/bin/uv && \
mv /root/.local/bin/uvx /usr/local/bin/uvx && \
chmod +x /usr/local/bin/uv /usr/local/bin/uvx
RUN python3 -m venv /opt/whisper-venv && \
/opt/whisper-venv/bin/pip install --no-cache-dir \
faster-whisper \
fastapi \
uvicorn \
python-multipart
ENV WHISPER_VENV=/opt/whisper-venv
WORKDIR /app
# Full base with TTS (Coqui only)
FROM base AS base-full
# Coqui TTS (Jenny voice)
RUN python3 -m venv /opt/coqui-venv && \
/opt/coqui-venv/bin/pip install --no-cache-dir \
TTS \
fastapi \
uvicorn \
python-multipart
ENV COQUI_VENV=/opt/coqui-venv
FROM base AS deps
COPY --chown=node:node package.json pnpm-workspace.yaml pnpm-lock.yaml ./
COPY --chown=node:node shared/package.json ./shared/
COPY --chown=node:node backend/package.json ./backend/
COPY --chown=node:node frontend/package.json ./frontend/
RUN pnpm install --frozen-lockfile
FROM base AS builder
COPY --from=deps /app ./
COPY shared ./shared
COPY backend ./backend
COPY frontend/src ./frontend/src
COPY frontend/public ./frontend/public
COPY frontend/index.html frontend/vite.config.ts frontend/tsconfig*.json frontend/components.json frontend/eslint.config.js ./frontend/
RUN pnpm --filter frontend build
FROM base-full AS runner
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=5003
ENV OPENCODE_SERVER_PORT=5551
ENV DATABASE_PATH=/app/data/opencode.db
ENV WORKSPACE_PATH=/workspace
COPY --from=deps --chown=node:node /app/node_modules ./node_modules
COPY --from=builder /app/shared ./shared
COPY --from=builder /app/backend ./backend
COPY --from=builder /app/frontend/dist ./frontend/dist
COPY --from=base /opt/whisper-venv /opt/whisper-venv
COPY --from=base-full /opt/coqui-venv /opt/coqui-venv
COPY scripts/whisper-server.py ./scripts/whisper-server.py
COPY scripts/coqui-server.py ./scripts/coqui-server.py
COPY package.json pnpm-workspace.yaml ./
ENV WHISPER_VENV=/opt/whisper-venv
ENV COQUI_VENV=/opt/coqui-venv
RUN mkdir -p /app/backend/node_modules/@opencode-manager && \
ln -s /app/shared /app/backend/node_modules/@opencode-manager/shared
COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
RUN mkdir -p /workspace /app/data && \
chown -R node:node /workspace /app/data
EXPOSE 5003 5100 5101 5102 5103
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
CMD curl -f http://localhost:5003/api/health || exit 1
USER node
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["bun", "backend/src/index.ts"]
# Slim runner for E2E tests - STT only (no TTS)
FROM base AS runner-slim
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=5003
ENV OPENCODE_SERVER_PORT=5551
ENV DATABASE_PATH=/app/data/opencode.db
ENV WORKSPACE_PATH=/workspace
COPY --from=deps --chown=node:node /app/node_modules ./node_modules
COPY --from=builder /app/shared ./shared
COPY --from=builder /app/backend ./backend
COPY --from=builder /app/frontend/dist ./frontend/dist
COPY --from=base /opt/whisper-venv /opt/whisper-venv
COPY scripts/whisper-server.py ./scripts/whisper-server.py
COPY package.json pnpm-workspace.yaml ./
ENV WHISPER_VENV=/opt/whisper-venv
RUN mkdir -p /app/backend/node_modules/@opencode-manager && \
ln -s /app/shared /app/backend/node_modules/@opencode-manager/shared
COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
RUN mkdir -p /workspace /app/data && \
chown -R node:node /workspace /app/data
EXPOSE 5003 5100 5101 5102 5103
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
CMD curl -f http://localhost:5003/api/health || exit 1
USER node
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["bun", "backend/src/index.ts"]