README / Dockerfile
alaskavix12's picture
Update Dockerfile
20642ce verified
Raw History Blame Contribute Delete
893 Bytes
FROM python:3.9
# Install aria2
RUN apt-get update && apt-get install -y aria2
# Create aria2 configuration file
RUN echo "enable-rpc=true" > /etc/aria2.conf && \
echo "rpc-listen-all=true" >> /etc/aria2.conf && \
echo "rpc-allow-origin-all=true" >> /etc/aria2.conf && \
echo "rpc-listen-port=6800" >> /etc/aria2.conf
# Create a user and set up the environment
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the application code
COPY --chown=user . /app
# Start aria2 in the background and the application in the foreground
CMD ["sh", "-c", "aria2c --conf-path=/etc/aria2.conf -D && gunicorn -k uvicorn.workers.UvicornWorker app:app --bind 0.0.0.0:7860", "python", "alive.py"]