MD Mahadi commited on
Update Dockerfile
Browse files- Dockerfile +39 -8
Dockerfile
CHANGED
|
@@ -1,17 +1,48 @@
|
|
| 1 |
-
# Use
|
| 2 |
FROM node:22-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Install OpenCode CLI globally
|
| 8 |
RUN npm install -g opencode-ai
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
# Hugging Face default port
|
| 14 |
EXPOSE 7860
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
CMD ["sh", "-c", "opencode web --hostname 0.0.0.0 --port 7860"]
|
|
|
|
| 1 |
+
# Use Node.js 22 slim image (includes Node.js and npm pre-installed)
|
| 2 |
FROM node:22-slim
|
| 3 |
|
| 4 |
+
# Prevent interactive prompts during package installation
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
|
| 7 |
+
# Install Python3, pip, venv, Git, curl, wget, build tools, and useful CLI utilities
|
| 8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
+
python3 \
|
| 10 |
+
python3-pip \
|
| 11 |
+
python3-venv \
|
| 12 |
+
python3-dev \
|
| 13 |
+
git \
|
| 14 |
+
curl \
|
| 15 |
+
wget \
|
| 16 |
+
bash \
|
| 17 |
+
ca-certificates \
|
| 18 |
+
build-essential \
|
| 19 |
+
jq \
|
| 20 |
+
ripgrep \
|
| 21 |
+
unzip \
|
| 22 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
+
|
| 24 |
+
# Create symlink so 'python' command points to 'python3'
|
| 25 |
+
RUN ln -sf /usr/bin/python3 /usr/bin/python
|
| 26 |
|
| 27 |
# Install OpenCode CLI globally
|
| 28 |
RUN npm install -g opencode-ai
|
| 29 |
|
| 30 |
+
# Point HOME, XDG, npm cache, and pip directories to /data for full persistence
|
| 31 |
+
ENV HOME=/data \
|
| 32 |
+
XDG_CONFIG_HOME=/data/.config \
|
| 33 |
+
XDG_DATA_HOME=/data/.local/share \
|
| 34 |
+
XDG_STATE_HOME=/data/.local/state \
|
| 35 |
+
XDG_CACHE_HOME=/data/.cache \
|
| 36 |
+
NPM_CONFIG_CACHE=/data/.npm \
|
| 37 |
+
PIP_CACHE_DIR=/data/.cache/pip \
|
| 38 |
+
PIP_BREAK_SYSTEM_PACKAGES=1 \
|
| 39 |
+
PATH="/data/.local/bin:${PATH}"
|
| 40 |
+
|
| 41 |
+
# Set default working directory inside /data/workspace
|
| 42 |
+
WORKDIR /data/workspace
|
| 43 |
|
| 44 |
+
# Hugging Face default port
|
| 45 |
EXPOSE 7860
|
| 46 |
|
| 47 |
+
# Ensure persistent directories exist, set permissions, and start OpenCode
|
| 48 |
+
CMD ["sh", "-c", "mkdir -p /data/workspace /data/.config /data/.local/share /data/.local/state /data/.cache /data/.npm /data/.local/bin && chmod -R 777 /data && opencode web --hostname 0.0.0.0 --port 7860"]
|