File size: 1,052 Bytes
bc4feba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91bc506
 
 
bc4feba
 
91bc506
 
 
 
 
bc4feba
 
 
91bc506
bc4feba
 
 
 
91bc506
bc4feba
 
 
 
2e5fb5a
bc4feba
 
91bc506
bc4feba
 
 
91bc506
bc4feba
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
# 1. Node.js stable version
FROM node:18-slim


# 2. Install required system tools & HF CLI
RUN apt-get update && apt-get install -y \
    curl \
    bash \
    git \
    python3 \
    python3-pip \
    python3.11-venv \
    build-essential \
    gcc \
    g++ \
    make \
    nano \
    zip \
    unzip \
    procps \
    inotify-tools \
    && curl -LsSf https://hf.co/cli/install.sh | bash \
    && rm -rf /var/lib/apt/lists/*


# 3. Copy OpenCode install script
COPY install.sh /install.sh
RUN chmod +x /install.sh


# 4. Install OpenCode from local script
RUN /install.sh


# 5. Setup folders
RUN mkdir -p /home && chmod 777 /home


# 6. Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh


# 7. Environment settings with RAM limit
ENV OPENCODE_DATA_DIR=/home
ENV HOME=/home
ENV PATH="/root/.local/bin:/home/node/.local/bin:/home/.local/bin:$PATH"
ENV NODE_OPTIONS="--max-old-space-size=14336"
ENV OPENCODE_SERVER_AUTH=false


# 8. Expose port 7860
EXPOSE 7860


# 9. Run entrypoint script
CMD ["/entrypoint.sh"]