File size: 1,602 Bytes
c72a395
a25adf1
8635771
c72a395
 
 
12307a4
c72a395
 
 
 
 
 
 
 
 
 
 
12307a4
c72a395
 
 
 
 
 
 
8635771
4220282
7490a8a
3044e64
03727e4
c106911
c72a395
 
 
 
 
 
 
 
 
 
 
 
 
c106911
c72a395
8635771
 
12307a4
b7f6dbb
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
# Use Node.js 22 slim image (includes Node.js and npm pre-installed)
FROM node:22-slim

# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive

# Install Python3, pip, venv, Git, curl, wget, build tools, sudo, and useful CLI utilities
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 \
    python3-pip \
    python3-venv \
    python3-dev \
    git \
    curl \
    wget \
    bash \
    ca-certificates \
    build-essential \
    sudo \
    jq \
    ripgrep \
    unzip \
    && rm -rf /var/lib/apt/lists/*

# Create symlink so 'python' command points to 'python3'
RUN ln -sf /usr/bin/python3 /usr/bin/python

# Install @opencode/cli globally
RUN npm install -g @opencode/cli
# Heroku CLI
RUN npm install -g heroku

# Point HOME, XDG, npm cache, and pip directories to /data for full persistence
ENV HOME=/data \
    XDG_CONFIG_HOME=/data/.config \
    XDG_DATA_HOME=/data/.local/share \
    XDG_STATE_HOME=/data/.local/state \
    XDG_CACHE_HOME=/data/.cache \
    NPM_CONFIG_CACHE=/data/.npm \
    PIP_CACHE_DIR=/data/.cache/pip \
    PIP_BREAK_SYSTEM_PACKAGES=1 \
    PATH="/data/.local/bin:${PATH}"

# Set default working directory inside /data/workspace
WORKDIR /data/workspace

# Hugging Face default port
EXPOSE 7860

# Fix ownership of /data at startup and start OpenCode server
CMD ["sh", "-c", "rm -rf /data/.cache/opencode/bin/opencode-pty && mkdir -p /data/workspace /data/.config/opencode /data/.local/share /data/.local/state /data/.cache /data/.npm /data/.local/bin && opencode serve --hostname 0.0.0.0 --port 7860"]