Spaces:
Sleeping
Sleeping
karthikrathod
commited on
Update Dockerfile
Browse files- Dockerfile +14 -8
Dockerfile
CHANGED
@@ -1,17 +1,23 @@
|
|
1 |
-
#
|
2 |
-
# you will also find guides on how best to write your Dockerfile
|
3 |
-
|
4 |
FROM python:3.9
|
5 |
|
6 |
-
|
|
|
|
|
7 |
|
8 |
-
|
|
|
9 |
|
|
|
|
|
10 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
11 |
|
|
|
12 |
RUN mkdir -p /storage
|
13 |
-
RUN
|
14 |
|
15 |
-
|
|
|
16 |
|
17 |
-
|
|
|
|
1 |
+
# Base image
|
|
|
|
|
2 |
FROM python:3.9
|
3 |
|
4 |
+
# Set a non-root user
|
5 |
+
RUN useradd -m appuser
|
6 |
+
USER appuser
|
7 |
|
8 |
+
# Set working directory
|
9 |
+
WORKDIR /code
|
10 |
|
11 |
+
# Copy requirements file and install dependencies
|
12 |
+
COPY --chown=appuser ./requirements.txt /code/requirements.txt
|
13 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
14 |
|
15 |
+
# Create storage directory with proper permissions
|
16 |
RUN mkdir -p /storage
|
17 |
+
RUN chown appuser:appuser /storage
|
18 |
|
19 |
+
# Copy application code
|
20 |
+
COPY --chown=appuser . /code
|
21 |
|
22 |
+
# Set the command to run the app
|
23 |
+
CMD ["streamlit", "run", "streamlit_app.py", "--server.port", "7860"]
|