Spaces:
Sleeping
Sleeping
Commit
•
46bc778
1
Parent(s):
31774d0
Create Dockerfile
Browse files- Dockerfile +41 -0
Dockerfile
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## Use the official Python 3.9 image
|
2 |
+
FROM python:3.9
|
3 |
+
|
4 |
+
## set the working directory to /code
|
5 |
+
WORKDIR /code
|
6 |
+
|
7 |
+
RUN pwd && ls -lrth
|
8 |
+
|
9 |
+
## Copy the current directory contents in the container at /code
|
10 |
+
COPY ./requirements.txt /code/requirements.txt
|
11 |
+
|
12 |
+
RUN pwd && ls -lrth
|
13 |
+
|
14 |
+
## Install the requirements.txt
|
15 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
16 |
+
|
17 |
+
# Set up a new user named "user"
|
18 |
+
RUN useradd user
|
19 |
+
# Switch to the "user" user
|
20 |
+
USER user
|
21 |
+
|
22 |
+
# Set home to the user's home directory
|
23 |
+
|
24 |
+
ENV HOME=/home/user \
|
25 |
+
PATH=/home/user/.local/bin:$PATH
|
26 |
+
|
27 |
+
# Set the working directory to the user's home directory
|
28 |
+
WORKDIR $HOME/app
|
29 |
+
|
30 |
+
RUN pwd && ls -lrth
|
31 |
+
|
32 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
33 |
+
COPY --chown=user . $HOME/app
|
34 |
+
|
35 |
+
RUN pwd && ls -lrth
|
36 |
+
|
37 |
+
# Expose the port that Streamlit runs on (default is 8501)
|
38 |
+
EXPOSE 8501
|
39 |
+
|
40 |
+
# Run app.py when the container launches
|
41 |
+
CMD ["streamlit", "run", "app.py"]
|