| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | ############ BUILDER ############# pull official base imageFROM python:3.10.7-slim-buster as builder# set work directoryWORKDIR /usr/src/app# set environment variablesENV PYTHONDONTWRITEBYTECODE 1ENV PYTHONUNBUFFERED 1# install system dependenciesRUN apt-get update && \    apt-get install -y --no-install-recommends gcc# lintRUN pip install --upgrade pipCOPY . /usr/src/app/# install python dependenciesCOPY ./requirements.txt .RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt########## FINAL ########### pull official base imageFROM python:3.10.7-slim-buster# create directory for the app userRUN mkdir -p /home/app# create the app userRUN addgroup --system app && adduser --system --group app# create the appropriate directoriesENV HOME=/home/appENV APP_HOME=/home/app/webRUN mkdir $APP_HOMEWORKDIR $APP_HOME# install dependenciesRUN apt-get update && apt-get install -y --no-install-recommends netcatCOPY --from=builder /usr/src/app/wheels /wheelsCOPY --from=builder /usr/src/app/requirements.txt .RUN pip install --upgrade pipRUN pip install --no-cache /wheels/*# copy entrypoint-prod.shCOPY ./entrypoint.sh $APP_HOME# copy projectCOPY . $APP_HOME# chown all the files to the app userRUN chown -R app:app $APP_HOME# change to the app userUSER app#RUN chmod u+x ./entrypoint.shENTRYPOINT ["/home/app/web/entrypoint.sh"]
 |