ab-ms-core / Dockerfile
MukeshKapoor25's picture
Add Dockerfile for application setup with Python 3.11 and Uvicorn
e0f9521
raw
history blame contribute delete
684 Bytes
# Use a lightweight and stable Python 3.11 base image (Bullseye)
FROM python:3.11-slim-bullseye AS base
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PATH="/home/user/.local/bin:$PATH"
RUN apt-get update && apt-get install -y \
openssl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
USER user
WORKDIR /app
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=user . /app
EXPOSE 7860
CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "4", "--log-level", "info"]