Spaces:
Sleeping
Sleeping
shivakerur99
commited on
Commit
•
b15a5d2
1
Parent(s):
deec597
Update Dockerfile
Browse files- Dockerfile +23 -35
Dockerfile
CHANGED
@@ -32,51 +32,39 @@
|
|
32 |
|
33 |
|
34 |
|
35 |
-
# FROM python:3.9
|
36 |
-
# # Set working directory
|
37 |
-
# WORKDIR /code
|
38 |
-
|
39 |
-
# # Copy requirements file
|
40 |
-
# COPY ./requirements.txt /code/requirements.txt
|
41 |
-
|
42 |
-
# # Install Python dependencies
|
43 |
-
# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
44 |
-
|
45 |
-
# # Create a non-root user
|
46 |
-
# RUN useradd -m -u 1000 user
|
47 |
-
|
48 |
-
# # Switch to the non-root user
|
49 |
-
# USER user
|
50 |
-
|
51 |
-
# # Set environment variables including Hugging Face token
|
52 |
-
# ENV HOME=/home/user \
|
53 |
-
# PATH=/home/user/.local/bin:$PATH \
|
54 |
-
# HUGGINGFACEHUB_API_TOKEN=your_hugging_face_token_here
|
55 |
-
|
56 |
-
# # Set working directory for the user
|
57 |
-
# WORKDIR $HOME/app
|
58 |
-
|
59 |
-
# # Copy application code
|
60 |
-
# COPY --chown=user . $HOME/app
|
61 |
-
|
62 |
-
# # Run the application
|
63 |
-
# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
64 |
-
|
65 |
-
|
66 |
FROM python:3.9
|
67 |
-
|
68 |
WORKDIR /code
|
69 |
|
|
|
70 |
COPY ./requirements.txt /code/requirements.txt
|
71 |
|
|
|
72 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
73 |
|
74 |
-
|
|
|
75 |
|
76 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
RUN --mount=type=secret,id=EXAMPLE,mode=0444,required=true \
|
78 |
cat /run/secrets/EXAMPLE > /test
|
79 |
|
80 |
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
|
|
32 |
|
33 |
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
FROM python:3.9
|
36 |
+
# Set working directory
|
37 |
WORKDIR /code
|
38 |
|
39 |
+
# Copy requirements file
|
40 |
COPY ./requirements.txt /code/requirements.txt
|
41 |
|
42 |
+
# Install Python dependencies
|
43 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
44 |
|
45 |
+
# Create a non-root user
|
46 |
+
RUN useradd -m -u 1000 user
|
47 |
|
48 |
+
# Switch to the non-root user
|
49 |
+
USER user
|
50 |
+
|
51 |
+
# Set environment variables including Hugging Face token
|
52 |
+
ENV HOME=/home/user \
|
53 |
+
PATH=/home/user/.local/bin:$PATH \
|
54 |
+
|
55 |
RUN --mount=type=secret,id=EXAMPLE,mode=0444,required=true \
|
56 |
cat /run/secrets/EXAMPLE > /test
|
57 |
|
58 |
|
59 |
+
# Set working directory for the user
|
60 |
+
WORKDIR $HOME/app
|
61 |
+
|
62 |
+
# Copy application code
|
63 |
+
COPY --chown=user . $HOME/app
|
64 |
+
|
65 |
+
# Run the application
|
66 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
|