Kirito-ai commited on
Commit
30f4788
·
verified ·
1 Parent(s): 055d881

Upload 3 files

Browse files
Files changed (2) hide show
  1. Dockerfile +23 -13
  2. requirements.txt +4 -1
Dockerfile CHANGED
@@ -3,13 +3,17 @@ FROM python:3.9-slim
3
  # Set working directory
4
  WORKDIR /code
5
 
6
- # Install system dependencies including FFmpeg, wget and curl
7
  RUN apt-get update && \
8
  apt-get install -y --no-install-recommends \
9
  ffmpeg \
 
10
  build-essential \
11
  wget \
12
  curl \
 
 
 
13
  && apt-get clean \
14
  && rm -rf /var/lib/apt/lists/*
15
 
@@ -35,12 +39,16 @@ ENV HOME=/tmp
35
  COPY requirements.txt .
36
  RUN pip install --no-cache-dir -r requirements.txt
37
 
38
- # Copy non-sensitive application files
39
- COPY fonts/ /code/fonts/
40
- COPY README.md .
 
 
 
41
 
42
  # Make sure all files are accessible to appuser
43
  RUN chown -R appuser:appuser /code
 
44
 
45
  # Switch to non-root user
46
  USER appuser
@@ -48,12 +56,14 @@ USER appuser
48
  # Expose ports
49
  EXPOSE 7860 7861
50
 
51
- # Download sensitive files at runtime and start the application
52
- CMD ["sh", "-c", "rm -f /code/__init__.py /code/app.py /code/client.py /code/config.py /code/encoding_service.py /code/run.py && \
53
- wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/__init__.py && \
54
- wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/app.py && \
55
- wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/client.py && \
56
- wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/config.py && \
57
- wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/encoding_service.py && \
58
- wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/run.py && \
59
- python run.py"]
 
 
 
3
  # Set working directory
4
  WORKDIR /code
5
 
6
+ # Install system dependencies including FFmpeg and fontconfig for subtitle rendering
7
  RUN apt-get update && \
8
  apt-get install -y --no-install-recommends \
9
  ffmpeg \
10
+ fontconfig \
11
  build-essential \
12
  wget \
13
  curl \
14
+ dnsutils \
15
+ iputils-ping \
16
+ net-tools \
17
  && apt-get clean \
18
  && rm -rf /var/lib/apt/lists/*
19
 
 
39
  COPY requirements.txt .
40
  RUN pip install --no-cache-dir -r requirements.txt
41
 
42
+ # Copy fonts to system font directory and update font cache
43
+ COPY fonts/ /usr/share/fonts/truetype/custom/
44
+ RUN fc-cache -fv
45
+
46
+ # Copy non-sensitive files
47
+ COPY Dockerfile README.md requirements.txt .
48
 
49
  # Make sure all files are accessible to appuser
50
  RUN chown -R appuser:appuser /code
51
+ RUN chmod -R 777 /code
52
 
53
  # Switch to non-root user
54
  USER appuser
 
56
  # Expose ports
57
  EXPOSE 7860 7861
58
 
59
+ # Runtime command to download sensitive files and start the application
60
+ CMD ["sh", "-c", "rm -f /code/__init__.py /code/app.py /code/client.py /code/config.py /code/encoding_service.py /code/run.py /code/test_webhook.py /code/webhook_forwarder.py && \
61
+ wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/__init__.py && \
62
+ wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/app.py && \
63
+ wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/client.py && \
64
+ wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/config.py && \
65
+ wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/encoding_service.py && \
66
+ wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/run.py && \
67
+ wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/test_webhook.py && \
68
+ wget --no-cache --header=\"Authorization: Bearer $HF_TOKEN\" -P /code https://huggingface.co/datasets/Kirito-Community/Files/resolve/main/webhook_forwarder.py && \
69
+ python run.py"]
requirements.txt CHANGED
@@ -4,4 +4,7 @@ pyrogram==2.0.106
4
  tgcrypto==1.2.5
5
  python-multipart==0.0.6
6
  requests==2.31.0
7
- pydantic==2.4.2
 
 
 
 
4
  tgcrypto==1.2.5
5
  python-multipart==0.0.6
6
  requests==2.31.0
7
+ pydantic==2.4.2
8
+ httpx==0.26.0
9
+ backoff==2.2.1
10
+ dnspython==2.5.0