|
| 1 | +ARG DEBIAN_FLAVOR |
| 2 | +# Startup script generator |
| 3 | +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.20-${DEBIAN_FLAVOR} as startupCmdGen |
| 4 | +# GOPATH is set to "/go" in the base image |
| 5 | +WORKDIR /go/src |
| 6 | +COPY src/startupscriptgenerator/src . |
| 7 | +ARG GIT_COMMIT=unspecified |
| 8 | +ARG BUILD_NUMBER=unspecified |
| 9 | +ARG RELEASE_TAG_NAME=unspecified |
| 10 | +ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME} |
| 11 | +ENV GIT_COMMIT=${GIT_COMMIT} |
| 12 | +ENV BUILD_NUMBER=${BUILD_NUMBER} |
| 13 | +#Bake in client certificate path into image to avoid downloading it |
| 14 | +ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt" |
| 15 | +RUN ./build.sh python /opt/startupcmdgen/startupcmdgen |
| 16 | + |
| 17 | +FROM oryxdevmcr.azurecr.io/private/oryx/oryx-run-base-${DEBIAN_FLAVOR} as main |
| 18 | +ARG DEBIAN_FLAVOR |
| 19 | +ARG IMAGES_DIR=/tmp/oryx/images |
| 20 | +ARG BUILD_DIR=/tmp/oryx/build |
| 21 | +ENV DEBIAN_FLAVOR=${DEBIAN_FLAVOR} |
| 22 | + |
| 23 | +RUN apt-get update \ |
| 24 | + && apt-get upgrade -y \ |
| 25 | + && apt-get install -y --no-install-recommends \ |
| 26 | + xz-utils \ |
| 27 | + && rm -rf /var/lib/apt/lists/* |
| 28 | + |
| 29 | +ADD images ${IMAGES_DIR} |
| 30 | +ADD build ${BUILD_DIR} |
| 31 | +RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \; |
| 32 | +RUN find ${BUILD_DIR} -type f -iname "*.sh" -exec chmod +x {} \; |
| 33 | + |
| 34 | +ENV PYTHON_VERSION 3.10.13 |
| 35 | +RUN true |
| 36 | +COPY build/__pythonVersions.sh ${BUILD_DIR} |
| 37 | +RUN true |
| 38 | +COPY platforms/__common.sh /tmp/ |
| 39 | +RUN true |
| 40 | +COPY platforms/python/prereqs/build.sh /tmp/ |
| 41 | +RUN true |
| 42 | +COPY platforms/python/versions/${DEBIAN_FLAVOR}/versionsToBuild.txt /tmp/ |
| 43 | +RUN true |
| 44 | +COPY images/receiveGpgKeys.sh /tmp/receiveGpgKeys.sh |
| 45 | +RUN true |
| 46 | + |
| 47 | +RUN chmod +x /tmp/receiveGpgKeys.sh |
| 48 | +RUN chmod +x /tmp/build.sh && \ |
| 49 | + apt-get update && \ |
| 50 | + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 51 | + build-essential \ |
| 52 | + tk-dev \ |
| 53 | + uuid-dev \ |
| 54 | + libgeos-dev |
| 55 | + |
| 56 | +RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \ |
| 57 | + set -e \ |
| 58 | + && export ORYX_SDK_STORAGE_ACCOUNT_ACCESS_TOKEN_PATH="/run/secrets/oryx_sdk_storage_account_access_token" \ |
| 59 | + && ${BUILD_DIR}/buildPythonSdkByVersion.sh $PYTHON_VERSION |
| 60 | + |
| 61 | +RUN set -ex \ |
| 62 | + && cd /opt/python/ \ |
| 63 | + && ln -s 3.10.13 3.10 \ |
| 64 | + && ln -s 3.10 3 \ |
| 65 | + && echo /opt/python/3/lib >> /etc/ld.so.conf.d/python.conf \ |
| 66 | + && ldconfig \ |
| 67 | + && cd /opt/python/3/bin \ |
| 68 | + && ln -nsf idle3 idle \ |
| 69 | + && ln -nsf pydoc3 pydoc \ |
| 70 | + && ln -nsf python3-config python-config \ |
| 71 | + && rm -rf /var/lib/apt/lists/* |
| 72 | + |
| 73 | +ENV PATH="/opt/python/3/bin:${PATH}" |
| 74 | + |
| 75 | +# Bake Application Insights key from pipeline variable into final image |
| 76 | +ARG AI_CONNECTION_STRING |
| 77 | +ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING} |
| 78 | + |
| 79 | +RUN ${IMAGES_DIR}/runtime/python/install-dependencies.sh |
| 80 | +RUN pip install --upgrade pip \ |
| 81 | + && pip install gunicorn \ |
| 82 | + && pip install debugpy \ |
| 83 | + && pip install viztracer \ |
| 84 | + && pip install vizplugins \ |
| 85 | + && pip install orjson \ |
| 86 | + && ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx \ |
| 87 | + && rm -rf /var/lib/apt/lists/* \ |
| 88 | + && rm -rf /tmp/oryx |
| 89 | + |
| 90 | +COPY --from=startupCmdGen /opt/startupcmdgen/startupcmdgen /opt/startupcmdgen/startupcmdgen |
0 commit comments