Update Dockerfile
Browse files- Dockerfile +15 -6
Dockerfile
CHANGED
@@ -1,23 +1,32 @@
|
|
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 |
-
|
|
|
|
|
|
|
5 |
RUN apt-get update && apt-get install -y ffmpeg
|
|
|
|
|
6 |
RUN useradd -m -u 1000 user
|
7 |
USER user
|
8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
9 |
|
|
|
10 |
WORKDIR /app
|
11 |
|
|
|
12 |
COPY --chown=user ./requirements.txt requirements.txt
|
|
|
|
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
|
|
|
|
|
|
|
15 |
# Set permissions for all files and directories
|
16 |
RUN find /app -type f -exec chmod 644 {} \; && \
|
17 |
-
find /app -type d -exec chmod 755 {} \;
|
18 |
-
chmod 644 credentials.json && \
|
19 |
-
chown -R user:user /app
|
20 |
-
|
21 |
|
22 |
-
#
|
23 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
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 |
+
# Use a stable and available Python version
|
5 |
+
FROM python:3.11
|
6 |
+
|
7 |
+
# Install ffmpeg
|
8 |
RUN apt-get update && apt-get install -y ffmpeg
|
9 |
+
|
10 |
+
# Create a non - root user
|
11 |
RUN useradd -m -u 1000 user
|
12 |
USER user
|
13 |
ENV PATH="/home/user/.local/bin:$PATH"
|
14 |
|
15 |
+
# Set the working directory
|
16 |
WORKDIR /app
|
17 |
|
18 |
+
# Copy the requirements file
|
19 |
COPY --chown=user ./requirements.txt requirements.txt
|
20 |
+
|
21 |
+
# Install Python dependencies
|
22 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
23 |
|
24 |
+
# Copy all files from the build context to the container
|
25 |
+
COPY --chown=user . /app
|
26 |
+
|
27 |
# Set permissions for all files and directories
|
28 |
RUN find /app -type f -exec chmod 644 {} \; && \
|
29 |
+
find /app -type d -exec chmod 755 {} \;
|
|
|
|
|
|
|
30 |
|
31 |
+
# Set the command to run your application
|
32 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|