queue_flask / Dockerfile
multimodalart's picture
Update Dockerfile
79a0b50
raw
history blame
1.13 kB
# 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