# start from an existing image
FROM python:alpine

# set environment variables (used by python)
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# create a working directory and execute every remaining command from it
WORKDIR /py_backend

# copy the specified file(s) from the host to the working directory
COPY requirements.txt .

# run this command in the guest system (package installation)
RUN pip install --no-cache-dir -r requirements.txt

# copy the specified file(s) from the host to the working directory
COPY py_backend.py .

# run this command by default (from the working directory)
CMD ["uvicorn", "py_backend:app", "--host", "0.0.0.0", "--port", "9988"]
