cra / Dockerfile
Charan5775's picture
Update Dockerfile
5802512 verified
# Use an official Python runtime as a parent image
FROM python:3.12
# Set the working directory in the container
RUN --mount=type=secret,id=Access_key,mode=0444,required=true \
git clone $(cat /run/secrets/Access_key) /app
#COPY . /app
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
redis-server supervisor \
&& rm -rf /var/lib/apt/lists/*
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Install redis-server + supervisor + clean up
# Make port 7860 available to the world outside this container
EXPOSE 7860
RUN cp /app/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
#CMD ["gunicorn", "-w", "1", "-k", "uvicorn.workers.UvicornWorker", "app:app", "--bind", "0.0.0.0:7860", "--threads", "2", "--timeout", "120", "--forwarded-allow-ips", "*"]
#CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
CMD bash -c "redis-server & gunicorn -w 1 -k uvicorn.workers.UvicornWorker app:app --bind 0.0.0.0:7860 --threads 2 --timeout 120 --forwarded-allow-ips='*'"