Update Dockerfile
Browse files- Dockerfile +15 -1
Dockerfile
CHANGED
@@ -1,14 +1,28 @@
|
|
1 |
FROM python:3.9
|
2 |
|
|
|
3 |
RUN useradd -m -u 1000 user
|
4 |
USER user
|
5 |
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
|
|
|
7 |
WORKDIR /app
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
COPY --chown=user ./requirements.txt requirements.txt
|
10 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
11 |
|
|
|
12 |
COPY --chown=user . /app
|
13 |
|
14 |
-
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
+
# Add a non-root user
|
4 |
RUN useradd -m -u 1000 user
|
5 |
USER user
|
6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
7 |
|
8 |
+
# Set the working directory
|
9 |
WORKDIR /app
|
10 |
|
11 |
+
# Install ffmpeg
|
12 |
+
USER root
|
13 |
+
RUN apt-get update && \
|
14 |
+
apt-get install -y ffmpeg && \
|
15 |
+
rm -rf /var/lib/apt/lists/*
|
16 |
+
|
17 |
+
# Switch back to the non-root user
|
18 |
+
USER user
|
19 |
+
|
20 |
+
# Copy and install Python dependencies
|
21 |
COPY --chown=user ./requirements.txt requirements.txt
|
22 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
23 |
|
24 |
+
# Copy the application code
|
25 |
COPY --chown=user . /app
|
26 |
|
27 |
+
# Command to run the application
|
28 |
+
CMD ["gunicorn", "-b", "0.0.0.0:7860", "main:app"]
|