SIN-Deploy-Bot commited on
Commit
ea15c79
·
1 Parent(s): f9335bf

fix: robust Dockerfile with retries

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -12
Dockerfile CHANGED
@@ -2,38 +2,36 @@ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  git \
8
  curl \
9
  ca-certificates \
 
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Install opencode CLI (download and install .deb for linux amd64)
13
  RUN set -eux; \
14
- apt-get update; \
15
- apt-get install -y --no-install-recommends wget; \
16
- wget -O opencode.deb "https://github.com/anomalyco/opencode/releases/download/v1.3.17/opencode-desktop-linux-amd64.deb"; \
17
  dpkg -i opencode.deb || apt-get install -f -y; \
18
  rm -f opencode.deb; \
19
  apt-get clean; \
20
  rm -rf /var/lib/apt/lists/*; \
21
  opencode --version
22
 
23
- # Copy application
24
  COPY requirements.txt .
25
  RUN pip install --no-cache-dir -r requirements.txt
26
 
 
27
  COPY . /app
28
 
29
- # Create workspace directory for OpenSIN-Code repo
30
  RUN mkdir -p /workspace
31
 
32
- # Expose port
33
  EXPOSE 7860
34
-
35
- # Start script uses /home/user/project on HF or /workspace
36
- ENV HF_SPACE=true
37
- ENV PORT=7860
38
 
39
  CMD ["python", "app.py"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # System deps + wget
6
  RUN apt-get update && apt-get install -y \
7
  git \
8
  curl \
9
  ca-certificates \
10
+ wget \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # opencode CLI mit Retry
14
  RUN set -eux; \
15
+ for i in 1 2 3; do \
16
+ wget -q --show-progress -O opencode.deb "https://github.com/anomalyco/opencode/releases/download/v1.3.17/opencode-desktop-linux-amd64.deb" && break || sleep 3; \
17
+ done; \
18
  dpkg -i opencode.deb || apt-get install -f -y; \
19
  rm -f opencode.deb; \
20
  apt-get clean; \
21
  rm -rf /var/lib/apt/lists/*; \
22
  opencode --version
23
 
24
+ # Python deps
25
  COPY requirements.txt .
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
+ # App Code (achtet .dockerignore)
29
  COPY . /app
30
 
31
+ # Workspace
32
  RUN mkdir -p /workspace
33
 
 
34
  EXPOSE 7860
35
+ ENV HF_SPACE=true PORT=7860
 
 
 
36
 
37
  CMD ["python", "app.py"]