-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathnoble.Dockerfile
More file actions
100 lines (82 loc) · 3.6 KB
/
noble.Dockerfile
File metadata and controls
100 lines (82 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
ARG OS_FLAVOR
ARG BASE_IMAGE
# Startup script generator
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.26.2-bookworm as startupCmdGen
# GOPATH is set to "/go" in the base image
WORKDIR /go/src
COPY src/startupscriptgenerator/src .
ARG GIT_COMMIT=unspecified
ARG BUILD_NUMBER=unspecified
ARG RELEASE_TAG_NAME=unspecified
ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME}
ENV GIT_COMMIT=${GIT_COMMIT}
ENV BUILD_NUMBER=${BUILD_NUMBER}
# Bake in client certificate path into image to avoid downloading it
ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt"
RUN chmod +x build.sh && ./build.sh python /opt/startupcmdgen/startupcmdgen
# Build Python SDK from source in a disposable stage
FROM ${BASE_IMAGE} AS pythonSdkBuilder
ARG OS_FLAVOR
ARG PYTHON_FULL_VERSION
ARG PYTHON_VERSION
ENV PYTHON_VERSION=${PYTHON_FULL_VERSION}
COPY platforms/python/prereqs/build.sh /tmp/build.sh
COPY platforms/python/versions/${OS_FLAVOR}/versionsToBuild.txt /tmp/versionsToBuild.txt
COPY images/receiveGpgKeys.sh /tmp/receiveGpgKeys.sh
RUN chmod +x /tmp/build.sh /tmp/receiveGpgKeys.sh
RUN set -e \
&& mkdir -p /usr/src/python && cd /usr/src/python \
&& VERSION_LINE=$(grep "^${PYTHON_VERSION}," /tmp/versionsToBuild.txt) \
&& export GPG_KEY=$(echo "$VERSION_LINE" | cut -d',' -f2 | tr -d ' ') \
&& export PYTHON_SHA256=$(echo "$VERSION_LINE" | cut -d',' -f3 | tr -d ' ') \
&& export OS_FLAVOR=${OS_FLAVOR} \
&& /tmp/build.sh
FROM ${BASE_IMAGE} as main
ARG IMAGES_DIR=/tmp/oryx/images
ARG OS_FLAVOR
ENV OS_FLAVOR=${OS_FLAVOR}
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
xz-utils \
# Install gcc due to error installing viztracer returning gcc not found
gcc \
&& rm -rf /var/lib/apt/lists/*
ADD images ${IMAGES_DIR}
RUN find ${IMAGES_DIR} -type f -iname "*.sh" -exec chmod +x {} \;
ARG PYTHON_FULL_VERSION
ARG PYTHON_VERSION
ARG PYTHON_MAJOR_VERSION
ENV PYTHON_VERSION ${PYTHON_FULL_VERSION}
COPY --from=pythonSdkBuilder /opt/python/${PYTHON_FULL_VERSION} /opt/python/${PYTHON_FULL_VERSION}
RUN set -ex \
&& cd /opt/python/ \
&& ln -s ${PYTHON_FULL_VERSION} ${PYTHON_VERSION} \
&& ln -s ${PYTHON_VERSION} ${PYTHON_MAJOR_VERSION} \
&& echo /opt/python/${PYTHON_MAJOR_VERSION}/lib >> /etc/ld.so.conf.d/python.conf \
&& ldconfig \
&& if [ "${PYTHON_MAJOR_VERSION}" = "3" ]; then cd /opt/python/${PYTHON_MAJOR_VERSION}/bin \
&& ln -nsf idle3 idle \
&& ln -nsf pydoc3 pydoc \
&& ln -nsf python3-config python-config; fi \
&& rm -rf /var/lib/apt/lists/*
ENV PATH="/opt/python/${PYTHON_MAJOR_VERSION}/bin:${PATH}"
# Bake Application Insights key from pipeline variable into final image
ARG AI_CONNECTION_STRING
ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING}
#Bake in client certificate path into image to avoid downloading it
ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt"
# Oryx++ Builder variables
ENV CNB_STACK_ID="oryx.stacks.skeleton"
LABEL io.buildpacks.stack.id="oryx.stacks.skeleton"
RUN ${IMAGES_DIR}/runtime/python/install-dependencies.sh
RUN --mount=type=secret,id=pip_index_url,target=/run/secrets/pip_index_url \
pip install --index-url $(cat /run/secrets/pip_index_url) --upgrade pip && \
pip install --index-url $(cat /run/secrets/pip_index_url) gunicorn uvicorn==0.46.0 uvicorn-worker==0.4.0 debugpy viztracer==0.15.6 vizplugins==0.1.3 && \
ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/oryx
ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"
COPY --from=startupCmdGen /opt/startupcmdgen/startupcmdgen /opt/startupcmdgen/startupcmdgen