Spaces:
Runtime error
Runtime error
Commit
·
79a0b50
1
Parent(s):
900de1b
Update Dockerfile
Browse files- Dockerfile +11 -9
Dockerfile
CHANGED
@@ -4,9 +4,6 @@ FROM python:3.8-slim-buster
|
|
4 |
# Set up a new user named "user" with user ID 1000
|
5 |
RUN useradd -m -u 1000 user
|
6 |
|
7 |
-
# Switch to the "user" user
|
8 |
-
USER user
|
9 |
-
|
10 |
# Set home to the user's home directory
|
11 |
ENV HOME=/home/user \
|
12 |
PATH=/home/user/.local/bin:$PATH \
|
@@ -17,9 +14,12 @@ ENV HOME=/home/user \
|
|
17 |
WORKDIR $HOME/app
|
18 |
|
19 |
# Install necessary packages
|
20 |
-
RUN
|
21 |
-
&&
|
22 |
-
&&
|
|
|
|
|
|
|
23 |
|
24 |
# Upgrade pip
|
25 |
RUN pip install --no-cache-dir --upgrade pip
|
@@ -31,12 +31,14 @@ COPY --chown=user . $HOME/app
|
|
31 |
RUN pip install --no-cache-dir -r requirements.txt
|
32 |
|
33 |
# Setup NGINX
|
34 |
-
|
|
|
35 |
COPY --chown=user nginx.conf /etc/nginx/sites-available/
|
36 |
-
RUN
|
|
|
37 |
|
38 |
# Expose port for the app
|
39 |
EXPOSE 7680
|
40 |
|
41 |
# Start the application
|
42 |
-
CMD service nginx start && python app.py
|
|
|
4 |
# Set up a new user named "user" with user ID 1000
|
5 |
RUN useradd -m -u 1000 user
|
6 |
|
|
|
|
|
|
|
7 |
# Set home to the user's home directory
|
8 |
ENV HOME=/home/user \
|
9 |
PATH=/home/user/.local/bin:$PATH \
|
|
|
14 |
WORKDIR $HOME/app
|
15 |
|
16 |
# Install necessary packages
|
17 |
+
RUN apt-get update \
|
18 |
+
&& apt-get install -y nginx \
|
19 |
+
&& apt-get clean
|
20 |
+
|
21 |
+
# Switch to the "user" user
|
22 |
+
USER user
|
23 |
|
24 |
# Upgrade pip
|
25 |
RUN pip install --no-cache-dir --upgrade pip
|
|
|
31 |
RUN pip install --no-cache-dir -r requirements.txt
|
32 |
|
33 |
# Setup NGINX
|
34 |
+
USER root
|
35 |
+
RUN rm /etc/nginx/sites-enabled/default
|
36 |
COPY --chown=user nginx.conf /etc/nginx/sites-available/
|
37 |
+
RUN ln -s /etc/nginx/sites-available/nginx.conf /etc/nginx/sites-enabled/
|
38 |
+
USER user
|
39 |
|
40 |
# Expose port for the app
|
41 |
EXPOSE 7680
|
42 |
|
43 |
# Start the application
|
44 |
+
CMD service nginx start && python app.py
|