Spaces:
Sleeping
Sleeping
Commit
·
fea034a
1
Parent(s):
877fba8
Create Dockerfile
Browse files- Dockerfile +25 -0
Dockerfile
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.7.17
|
2 |
+
|
3 |
+
RUN apt-get -y update
|
4 |
+
|
5 |
+
# Set up a new user named "user" with user ID 1000
|
6 |
+
RUN useradd -m -u 1000 user
|
7 |
+
# Switch to the "user" user
|
8 |
+
USER user
|
9 |
+
# Set home to the user's home directory
|
10 |
+
ENV HOME=/home/user \
|
11 |
+
PATH=/home/user/.local/bin:$PATH
|
12 |
+
|
13 |
+
# Set the working directory to the user's home directory
|
14 |
+
WORKDIR $HOME/app
|
15 |
+
|
16 |
+
|
17 |
+
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
|
18 |
+
RUN pip install --no-cache-dir --upgrade pip
|
19 |
+
|
20 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
21 |
+
COPY --chown=user . $HOME/app
|
22 |
+
|
23 |
+
RUN pip install -r requirements.txt
|
24 |
+
|
25 |
+
CMD ["python", "app.py"]
|