protocol-api-mirror / Dockerfile
muryshev's picture
Deploy fix
2926041
raw
history blame
885 Bytes
# Use an official Python runtime as a parent image
FROM python:3.10-slim-bullseye
# Set Python to use unbuffered mode
ENV PYTHONUNBUFFERED=1
ENV PATH="/var/www/.local/bin:${PATH}"
# Create a non-root user
RUN useradd -m -u 1000 -U -s /bin/bash myuser
# Install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends python3-pip python3-dev && \
rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
RUN mkdir /var/www
ENV HOME=/var/www
WORKDIR /var/www
# Change ownership of /var/www to the non-root user
RUN chown -R myuser:myuser /var/www
# Switch to the non-root user
USER myuser
# Copy the current directory contents into the container at /var/www
COPY . /var/www
RUN pip install --user -r requirements.txt
# Expose the port
EXPOSE 7860
# Run app.py when the container launches
CMD flask run --host=0.0.0.0 --port=7860