Spaces:
Runtime error
Runtime error
# 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 | |