Update Dockerfile
Browse files- Dockerfile +13 -12
Dockerfile
CHANGED
@@ -1,27 +1,28 @@
|
|
1 |
-
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
-
# you will also find guides on how best to write your Dockerfile
|
3 |
-
|
4 |
FROM python:3.11
|
5 |
|
6 |
-
#
|
7 |
-
RUN useradd -m -u 1000 user
|
8 |
-
# Install FFmpeg as root
|
9 |
-
USER root
|
10 |
RUN apt-get update && apt-get install -y ffmpeg
|
11 |
|
12 |
-
#
|
|
|
13 |
USER user
|
14 |
ENV PATH="/home/user/.local/bin:$PATH"
|
15 |
|
16 |
# Set the working directory
|
17 |
WORKDIR /app
|
18 |
|
19 |
-
#
|
20 |
COPY --chown=user ./requirements.txt requirements.txt
|
|
|
|
|
21 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
22 |
|
23 |
-
# Copy
|
24 |
COPY --chown=user . /app
|
25 |
|
26 |
-
#
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
FROM python:3.11
|
2 |
|
3 |
+
# Install ffmpeg
|
|
|
|
|
|
|
4 |
RUN apt-get update && apt-get install -y ffmpeg
|
5 |
|
6 |
+
# Create a non - root user
|
7 |
+
RUN useradd -m -u 1000 user
|
8 |
USER user
|
9 |
ENV PATH="/home/user/.local/bin:$PATH"
|
10 |
|
11 |
# Set the working directory
|
12 |
WORKDIR /app
|
13 |
|
14 |
+
# Copy the requirements file
|
15 |
COPY --chown=user ./requirements.txt requirements.txt
|
16 |
+
|
17 |
+
# Install Python dependencies
|
18 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
19 |
|
20 |
+
# Copy all files from the build context to the container
|
21 |
COPY --chown=user . /app
|
22 |
|
23 |
+
# Set permissions for all files and directories
|
24 |
+
RUN find /app -type f -exec chmod 644 {} \; && \
|
25 |
+
find /app -type d -exec chmod 755 {} \;
|
26 |
+
|
27 |
+
# Set the command to run your application
|
28 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|