|  |  | 
					
						
						|  |  | 
					
						
						|  | FROM python:3.9 | 
					
						
						|  |  | 
					
						
						|  | RUN useradd -m -u 1000 user | 
					
						
						|  | USER user | 
					
						
						|  | ENV PATH="/home/user/.local/bin:$PATH" | 
					
						
						|  |  | 
					
						
						|  | WORKDIR /app | 
					
						
						|  |  | 
					
						
						|  | ARG PYTORCH_VERSION=2.1.0 | 
					
						
						|  | ARG PYTHON_VERSION=3.8.10 | 
					
						
						|  | ARG CUDA_VERSION=11.8 | 
					
						
						|  | ARG CU_DNN=8.5.0.96 | 
					
						
						|  | ARG CUDA_CHANNEL=nvidia | 
					
						
						|  | ARG INSTALL_CHANNEL=pytorch | 
					
						
						|  |  | 
					
						
						|  | ARG TARGETPLATFORM | 
					
						
						|  |  | 
					
						
						|  |  | 
					
						
						|  |  | 
					
						
						|  |  | 
					
						
						|  | RUN case ${TARGETPLATFORM} in \ | 
					
						
						|  | "linux/arm64")  exit 1 ;; \ | 
					
						
						|  | *)              /opt/conda/bin/conda update -y conda &&  \ | 
					
						
						|  | /opt/conda/bin/conda install -c "${INSTALL_CHANNEL}" -c "${CUDA_CHANNEL}" -y "python=${PYTHON_VERSION}" "pytorch=$PYTORCH_VERSION" "pytorch-cuda=$(echo $CUDA_VERSION | cut -d'.' -f 1-2)"  ;; \ | 
					
						
						|  | esac && \ | 
					
						
						|  | /opt/conda/bin/conda clean -ya | 
					
						
						|  |  | 
					
						
						|  | COPY --chown=user ./requirements.txt requirements.txt | 
					
						
						|  | RUN pip install --no-cache-dir --upgrade -r requirements.txt | 
					
						
						|  |  | 
					
						
						|  | RUN git clone https://github.com/lee-ny/teaching_arithmetic.git && cd teaching_arithmetic | 
					
						
						|  |  | 
					
						
						|  |  | 
					
						
						|  |  | 
					
						
						|  | RUN pip install -e . | 
					
						
						|  |  | 
					
						
						|  |  | 
					
						
						|  | COPY --chown=user . /app | 
					
						
						|  | CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | 
					
						
						|  |  |