discord-bot / Dockerfile
NameIsJACK's picture
Create Dockerfile
e21c1a5 verified
raw
history blame contribute delete
651 Bytes
FROM python:3.9
# Create and switch to a non-root user
RUN useradd -m -u 1000 user
USER root
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
RUN apt-get update && apt-get install -y pandoc
# Create uploads dir (if used later) and set permissions
RUN mkdir -p /app/uploads && chown user:user /app/uploads
# Install dependencies
COPY --chown=user:user requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy source code
COPY --chown=user:user . /app
# Switch to non-root user
USER user
# Start FastAPI app (which internally starts the bot)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]