iralex-badmin/Dockerfile

44 lines
1.1 KiB
Docker

# Official Python runtime
FROM python:3.10-slim
# Prevent Python from writing .pyc files and enable unbuffered stdout/stderr
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PORT=8000
# Install minimal system packages required to build native wheels and runtime libs
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
gcc \
g++ \
libpq-dev \
unixodbc-dev \
libffi-dev \
libxml2-dev \
libxslt1-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
pkg-config \
ca-certificates \
wget && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# copy dependency file and install
COPY req.txt .
RUN python -m pip install --upgrade pip setuptools wheel && \
pip install --no-cache-dir -r req.txt
# copy app source
COPY . .
# Create a non-root user and give ownership of the app folder
RUN useradd --create-home appuser && chown -R appuser:appuser /app
USER appuser
EXPOSE 8000
# Start the app (adjust module:path if your entrypoint is different)
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]