Spaces:
Runtime error
Runtime error
File size: 1,126 Bytes
900de1b a0f2e08 900de1b a0f2e08 900de1b a0f2e08 79a0b50 900de1b a0f2e08 900de1b a0f2e08 79a0b50 900de1b 79a0b50 a0f2e08 79a0b50 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# Set up the environment with Python
FROM python:3.8-slim-buster
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
API_ENDPOINT=$API_ENDPOINT \
WORKERS=$WORKERS
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Install necessary packages
RUN apt-get update \
&& apt-get install -y nginx \
&& apt-get clean
# Switch to the "user" user
USER user
# Upgrade pip
RUN pip install --no-cache-dir --upgrade pip
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Setup NGINX
USER root
RUN rm /etc/nginx/sites-enabled/default
COPY --chown=user nginx.conf /etc/nginx/sites-available/
RUN ln -s /etc/nginx/sites-available/nginx.conf /etc/nginx/sites-enabled/
USER user
# Expose port for the app
EXPOSE 7680
# Start the application
CMD service nginx start && python app.py |