kacapower commited on
Commit
66b9dc6
·
verified ·
1 Parent(s): dadb38c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -20
Dockerfile CHANGED
@@ -1,26 +1,36 @@
1
- # Use a lightweight Debian-based Python image
2
- FROM python:3.10-slim
3
-
4
- # Install the four core conversion engines
5
- RUN apt-get update && apt-get install -y \
6
- ffmpeg \
7
- libreoffice \
8
- imagemagick \
9
- pandoc \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Set the working directory
13
- WORKDIR /app
 
 
 
 
 
 
 
 
 
 
 
14
 
15
- # Copy and install Python dependencies
16
- COPY requirements.txt .
17
- RUN pip install --no-cache-dir -r requirements.txt
18
 
19
- # Copy the API code
20
- COPY . .
21
 
22
- # Expose the mandatory port for Hugging Face Spaces
23
- EXPOSE 7860
24
 
25
- # Start the FastAPI server
26
- CMD ["python", "main.py"]
 
 
 
1
+ FROM node:20-bookworm-slim
2
+
3
+ # System dependencies
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ git \
6
+ ca-certificates \
7
+ curl \
 
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Install OpenCode globally via the official installer.
11
+ # OPENCODE_INSTALL_DIR points the installer at /usr/local/bin so the
12
+ # `opencode` binary is on the default PATH for every user.
13
+ ENV OPENCODE_INSTALL_DIR=/usr/local/bin
14
+ RUN curl -fsSL https://opencode.ai/install | bash
15
+
16
+ # Hugging Face Spaces runs containers as UID 1000.
17
+ RUN useradd -m -u 1000 user
18
+
19
+ ENV HOME=/home/user
20
+ # Make sure the `user` account picks up /usr/local/bin (root's PATH already
21
+ # includes it, but $HOME/.local/bin is the conventional place for user bins).
22
+ ENV PATH=/home/user/.local/bin:/usr/local/bin:${PATH}
23
 
24
+ # Create a workspace directory the user can clone projects into and own it.
25
+ RUN mkdir -p $HOME/workspace && chown -R user:user $HOME
 
26
 
27
+ USER user
28
+ WORKDIR $HOME/workspace
29
 
30
+ # The port must match `app_port` in the README's YAML block.
31
+ EXPOSE 4096
32
 
33
+ # Start the OpenCode web server.
34
+ # --hostname 0.0.0.0 => reachable by HF's reverse proxy (not just localhost)
35
+ # OPENCODE_SERVER_PASSWORD env var (set as a Space secret) enables basic auth.
36
+ CMD ["opencode", "web", "--port", "4096", "--hostname", "0.0.0.0"]