wahtever / Dockerfile
threeorfour's picture
Update Dockerfile
9232d48 verified
raw
history blame contribute delete
913 Bytes
# Use a stable Python base image
FROM python:3.9-slim
# Set environment variables to prevent interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
# Install necessary system dependencies, including Chromium and Xvfb
RUN apt-get update && \
apt-get install -y --no-install-recommends \
chromium \
chromium-driver \
xvfb \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create a non-root user for security
RUN useradd -m appuser
USER appuser
WORKDIR /home/appuser/app
# Copy the requirements file and install Python packages
COPY --chown=appuser:appuser requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY --chown=appuser:appuser main.py .
# Expose the port the API will run on
EXPOSE 7860
# The command to run the FastAPI application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]