Spaces:
Sleeping
Sleeping
shivakerur99
commited on
Commit
•
efc4754
1
Parent(s):
8a157ca
Update Dockerfile
Browse files- Dockerfile +39 -2
Dockerfile
CHANGED
@@ -1,20 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
WORKDIR /code
|
4 |
|
|
|
5 |
COPY ./requirements.txt /code/requirements.txt
|
6 |
|
|
|
7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
|
|
9 |
RUN useradd -m -u 1000 user
|
10 |
|
|
|
11 |
USER user
|
12 |
|
|
|
13 |
ENV HOME=/home/user \
|
14 |
-
|
15 |
|
|
|
16 |
WORKDIR $HOME/app
|
17 |
|
|
|
18 |
COPY --chown=user . $HOME/app
|
19 |
|
20 |
-
|
|
|
|
1 |
+
# FROM python:3.9
|
2 |
+
|
3 |
+
# WORKDIR /code
|
4 |
+
|
5 |
+
# COPY ./requirements.txt /code/requirements.txt
|
6 |
+
|
7 |
+
# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
+
|
9 |
+
# RUN useradd -m -u 1000 user
|
10 |
+
|
11 |
+
# USER user
|
12 |
+
|
13 |
+
# ENV HOME=/home/user \
|
14 |
+
# PATH=/home/user/.local/bin:$PATH
|
15 |
+
|
16 |
+
# WORKDIR $HOME/app
|
17 |
+
|
18 |
+
# COPY --chown=user . $HOME/app
|
19 |
+
|
20 |
+
# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
FROM python:3.9
|
25 |
|
26 |
+
# Install ffmpeg
|
27 |
+
RUN apt-get update && \
|
28 |
+
apt-get install -y ffmpeg && \
|
29 |
+
rm -rf /var/lib/apt/lists/*
|
30 |
+
|
31 |
+
# Set working directory
|
32 |
WORKDIR /code
|
33 |
|
34 |
+
# Copy requirements file
|
35 |
COPY ./requirements.txt /code/requirements.txt
|
36 |
|
37 |
+
# Install Python dependencies
|
38 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
39 |
|
40 |
+
# Create a non-root user
|
41 |
RUN useradd -m -u 1000 user
|
42 |
|
43 |
+
# Switch to the non-root user
|
44 |
USER user
|
45 |
|
46 |
+
# Set environment variables
|
47 |
ENV HOME=/home/user \
|
48 |
+
PATH=/home/user/.local/bin:$PATH
|
49 |
|
50 |
+
# Set working directory for the user
|
51 |
WORKDIR $HOME/app
|
52 |
|
53 |
+
# Copy application code
|
54 |
COPY --chown=user . $HOME/app
|
55 |
|
56 |
+
# Run the application
|
57 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|