| FROM python:3.9-slim |
|
|
| |
| WORKDIR /code |
|
|
| |
| RUN apt-get update && \ |
| apt-get install -y --no-install-recommends \ |
| ffmpeg \ |
| fontconfig \ |
| build-essential \ |
| wget \ |
| curl \ |
| dnsutils \ |
| iputils-ping \ |
| net-tools \ |
| && apt-get clean \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN adduser --disabled-password --gecos '' appuser |
|
|
| |
| RUN mkdir -p /tmp/downloads && \ |
| mkdir -p /tmp/.cache/matplotlib && \ |
| mkdir -p /tmp/.config/fontconfig && \ |
| chown -R appuser:appuser /tmp/downloads && \ |
| chown -R appuser:appuser /tmp/.cache && \ |
| chown -R appuser:appuser /tmp/.config |
|
|
| |
| ENV PYTHONUNBUFFERED=1 |
| ENV MPLCONFIGDIR=/tmp/.cache/matplotlib |
| ENV XDG_CACHE_HOME=/tmp/.cache |
| ENV XDG_CONFIG_HOME=/tmp/.config |
| ENV HOME=/tmp |
|
|
| |
| COPY requirements.txt . |
| RUN pip install --no-cache-dir -r requirements.txt |
|
|
| |
| COPY fonts/ /usr/share/fonts/truetype/custom/ |
| RUN fc-cache -fv |
|
|
| |
| COPY . . |
|
|
| |
| RUN chown -R appuser:appuser /code |
| RUN chmod -R 777 /code |
|
|
| |
| USER appuser |
|
|
| |
| EXPOSE 7860 7861 |
|
|
| |
| CMD ["sh", "-c", "rm -f /code/__init__.py /code/app.py /code/client.py /code/config.py /code/encoding_service.py /code/run.py && \ |
| wget --no-cache --header=\"Authorization: Bearer $API_KEY\" -P /code https://sitejupiter.com/hf-codes/encoding/__init__.py && \ |
| wget --no-cache --header=\"Authorization: Bearer $API_KEY\" -P /code https://sitejupiter.com/hf-codes/encoding/app.py && \ |
| wget --no-cache --header=\"Authorization: Bearer $API_KEY\" -P /code https://sitejupiter.com/hf-codes/encoding/client.py && \ |
| wget --no-cache --header=\"Authorization: Bearer $API_KEY\" -P /code https://sitejupiter.com/hf-codes/encoding/config.py && \ |
| wget --no-cache --header=\"Authorization: Bearer $API_KEY\" -P /code https://sitejupiter.com/hf-codes/encoding/encoding_service.py && \ |
| wget --no-cache --header=\"Authorization: Bearer $API_KEY\" -P /code https://sitejupiter.com/hf-codes/encoding/run.py && \ |
| python run.py"] |