Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +21 -11
Dockerfile
CHANGED
|
@@ -1,26 +1,36 @@
|
|
| 1 |
FROM python:3.10.9
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
COPY ./requirements.txt /code/requirements.txt
|
| 6 |
-
|
| 7 |
-
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 8 |
-
RUN apt update && apt install -y ffmpeg
|
| 9 |
-
|
| 10 |
RUN useradd -m -u 1000 user
|
|
|
|
|
|
|
| 11 |
USER user
|
|
|
|
|
|
|
| 12 |
ENV HOME=/home/user \
|
| 13 |
-
|
| 14 |
|
|
|
|
| 15 |
WORKDIR $HOME/app
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
COPY --chown=user . $HOME/app
|
| 18 |
-
|
| 19 |
-
RUN chmod 777 /data
|
| 20 |
# Set environment variables
|
| 21 |
ENV NUMBA_CACHE_DIR=/tmp/NUMBA_CACHE_DIR/
|
| 22 |
ENV MPLCONFIGDIR=/tmp/MPLCONFIGDIR/
|
| 23 |
-
ENV HOME=/home/appuser
|
| 24 |
ENV PATH="/opt/venv/bin:$PATH"
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM python:3.10.9
|
| 2 |
|
| 3 |
+
# Set up a new user named "user" with user ID 1000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
+
|
| 6 |
+
# Switch to the "user" user
|
| 7 |
USER user
|
| 8 |
+
|
| 9 |
+
# Set home to the user's home directory
|
| 10 |
ENV HOME=/home/user \
|
| 11 |
+
PATH=/home/user/.local/bin:$PATH
|
| 12 |
|
| 13 |
+
# Set the working directory to the user's home directory
|
| 14 |
WORKDIR $HOME/app
|
| 15 |
|
| 16 |
+
# Upgrade pip
|
| 17 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 18 |
+
|
| 19 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 20 |
COPY --chown=user . $HOME/app
|
| 21 |
+
|
|
|
|
| 22 |
# Set environment variables
|
| 23 |
ENV NUMBA_CACHE_DIR=/tmp/NUMBA_CACHE_DIR/
|
| 24 |
ENV MPLCONFIGDIR=/tmp/MPLCONFIGDIR/
|
|
|
|
| 25 |
ENV PATH="/opt/venv/bin:$PATH"
|
| 26 |
|
| 27 |
+
# Ensure permissions are correct for the home directory and app directory
|
| 28 |
+
RUN chmod -R 755 /home/user
|
| 29 |
+
RUN chmod -R 755 $HOME/app
|
| 30 |
+
|
| 31 |
+
# Add your specific data or model checkpoint
|
| 32 |
+
RUN mkdir -p /data
|
| 33 |
+
RUN chmod 777 /data
|
| 34 |
+
ADD --chown=user https://<SOME_ASSET_URL> content/<SOME_ASSET_NAME>
|
| 35 |
+
|
| 36 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|