Spaces:
Runtime error
Runtime error
File size: 1,132 Bytes
900de1b a0f2e08 900de1b a0f2e08 900de1b a0f2e08 900de1b a0f2e08 900de1b a0f2e08 900de1b a0f2e08 900de1b |
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 |
# 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
# Switch to the "user" user
USER 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 sudo apt-get update \
&& sudo apt-get install -y nginx \
&& sudo apt-get clean
# 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
RUN sudo rm /etc/nginx/sites-enabled/default
COPY --chown=user nginx.conf /etc/nginx/sites-available/
RUN sudo ln -s /etc/nginx/sites-available/nginx.conf /etc/nginx/sites-enabled/
# Expose port for the app
EXPOSE 7680
# Start the application
CMD service nginx start && python app.py
|