FROM python:3.8.10-slim WORKDIR /app # install linux package dependencies RUN apt-get update -y # User RUN useradd -m -u 1000 user USER user ENV HOME /home/user ENV PATH $HOME/.local/bin:$PATH WORKDIR $HOME RUN mkdir app WORKDIR $HOME/app # can copy files only from current working directory where docker builds # cannot copy files from arbitrary directories COPY ./artifacts/ /data/models/ COPY ./requirements.txt . RUN pip install --no-cache-dir torch==1.11.0+cpu torchvision==0.12.0+cpu torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cpu RUN pip install --no-cache-dir -r requirements.txt COPY ./cassava_leaf_disease/*.py ./cassava_leaf_disease/ COPY ./*.py . COPY ./*.json . EXPOSE 7860 CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]