cats_dogs / Dockerfile
mramjad's picture
Update Dockerfile
b63e167 verified
raw
history blame contribute delete
599 Bytes
FROM python:3.8-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Create a non-root user and switch to it
RUN useradd -m appuser
WORKDIR /app
RUN chown appuser:appuser /app
USER appuser
# Create a virtual environment
RUN python -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY --chown=appuser:appuser . .
# Expose the port
EXPOSE 7860
# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]