Commit | Line | Data |
---|---|---|
74ad74b2 | 1 | FROM debian:bullseye-slim |
403c6ed0 AV |
2 | |
3 | ARG USER="mta" | |
4 | ARG USER_HOME_DIR="/home/${USER}" | |
5 | ENV HOME ${USER_HOME_DIR} | |
6 | ||
7 | RUN set -ex \ | |
8 | && apt-get update \ | |
9 | && apt-get install -y openssl --no-install-recommends \ | |
10 | && rm -rf /var/lib/apt/lists/* \ | |
9277df83 | 11 | # smoke test |
b4603354 | 12 | && openssl version \ |
403c6ed0 AV |
13 | && useradd --home-dir ${USER_HOME_DIR} \ |
14 | --create-home \ | |
15 | --shell /bin/bash \ | |
16 | --user-group \ | |
17 | --uid 1000 \ | |
18 | --comment 'Cloud MTA Build Tool' \ | |
19 | --password "$(echo weUseMta | openssl passwd -1 -stdin)" ${USER} \ | |
a739e5ea JB |
20 | # allow anybody to write into the image user home directory |
21 | && chmod a+w ${USER_HOME_DIR} \ | |
22 | && apt-get remove --purge --autoremove -y openssl | |
403c6ed0 AV |
23 | |
24 | ADD http://aia.pki.co.sap.com/aia/SAP%20Global%20Root%20CA.crt \ | |
25 | /etc/ssl/certs/SAP_Global_Root_CA.crt | |
26 | ||
dd944ae1 | 27 | ARG NODE_VERSION=16.19.0 |
403c6ed0 AV |
28 | |
29 | RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ | |
30 | && case "${dpkgArch##*-}" in \ | |
31 | amd64) ARCH='x64';; \ | |
32 | ppc64el) ARCH='ppc64le';; \ | |
33 | s390x) ARCH='s390x';; \ | |
34 | arm64) ARCH='arm64';; \ | |
35 | armhf) ARCH='armv7l';; \ | |
36 | i386) ARCH='x86';; \ | |
37 | *) echo "unsupported architecture"; exit 1 ;; \ | |
38 | esac \ | |
39 | && set -ex \ | |
40 | && apt-get update \ | |
41 | # libatomic1 for arm | |
69527ac7 | 42 | && apt-get install -y ca-certificates curl gnupg dirmngr xz-utils libatomic1 --no-install-recommends \ |
403c6ed0 | 43 | && rm -rf /var/lib/apt/lists/* \ |
7dcc5c4a | 44 | && export GNUPGHOME="$(mktemp -d)" \ |
403c6ed0 AV |
45 | && for key in \ |
46 | 4ED778F539E3634C779C87C6D7062848A1AB005C \ | |
47 | 141F07595B7B3FFE74309A937405533BE57C7D57 \ | |
403c6ed0 | 48 | 74F12602B6F1C4E913FAA37AD3A89613643B6201 \ |
403c6ed0 AV |
49 | 61FC681DFB92A079F1685E77973F295594EC4689 \ |
50 | 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ | |
51 | C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ | |
52 | 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \ | |
53 | C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ | |
403c6ed0 | 54 | 108F52B48DB57BB0CC439B2997B01419BD92F80A \ |
403c6ed0 AV |
55 | ; do \ |
56 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ | |
c52f471b | 57 | gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \ |
403c6ed0 AV |
58 | done \ |
59 | && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ | |
60 | && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ | |
61 | && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ | |
62 | && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ | |
63 | && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ | |
7dcc5c4a | 64 | && rm -rf "$GNUPGHOME" "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ |
403c6ed0 AV |
65 | && apt-mark auto '.*' > /dev/null \ |
66 | && find /usr/local -type f -executable -exec ldd '{}' ';' \ | |
67 | | awk '/=>/ { print $(NF-1) }' \ | |
68 | | sort -u \ | |
69 | | xargs -r dpkg-query --search \ | |
70 | | cut -d: -f1 \ | |
71 | | sort -u \ | |
72 | | xargs -r apt-mark manual \ | |
73 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ | |
74 | && ln -s /usr/local/bin/node /usr/local/bin/nodejs \ | |
75 | # smoke tests | |
76 | && node --version \ | |
77 | && npm --version | |
78 | ||
79 | ARG YARN_VERSION=1.22.19 | |
80 | ||
81 | RUN set -ex \ | |
82 | && savedAptMark="$(apt-mark showmanual)" \ | |
8c37d866 | 83 | && apt-get update \ |
69527ac7 | 84 | && apt-get install -y ca-certificates curl gnupg dirmngr --no-install-recommends \ |
403c6ed0 | 85 | && rm -rf /var/lib/apt/lists/* \ |
7dcc5c4a | 86 | && export GNUPGHOME="$(mktemp -d)" \ |
403c6ed0 AV |
87 | && for key in \ |
88 | 6A010C5166006599AA17F08146C2130DFD2497F5 \ | |
89 | ; do \ | |
90 | gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ | |
c52f471b | 91 | gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \ |
403c6ed0 AV |
92 | done \ |
93 | && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ | |
94 | && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ | |
95 | && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ | |
96 | && mkdir -p /opt \ | |
97 | && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \ | |
98 | && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ | |
99 | && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ | |
7dcc5c4a | 100 | && rm -rf "$GNUPGHOME" yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ |
403c6ed0 AV |
101 | && apt-mark auto '.*' > /dev/null \ |
102 | && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; } \ | |
103 | && find /usr/local -type f -executable -exec ldd '{}' ';' \ | |
104 | | awk '/=>/ { print $(NF-1) }' \ | |
105 | | sort -u \ | |
106 | | xargs -r dpkg-query --search \ | |
107 | | cut -d: -f1 \ | |
108 | | sort -u \ | |
109 | | xargs -r apt-mark manual \ | |
110 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ | |
111 | # smoke test | |
112 | && yarn --version | |
113 | ||
f7c888a8 | 114 | ARG SAPMACHINE_VERSION=11.0.17 |
8c37d866 | 115 | |
3a2f4da1 JB |
116 | ENV JAVA_HOME /opt/jdk |
117 | ||
118 | RUN ARCH=; SAPMACHINE_MAJOR_VERSION=$(echo ${SAPMACHINE_VERSION} | cut -d. -f1) \ | |
119 | && dpkgArch="$(dpkg --print-architecture)" \ | |
865db469 JB |
120 | && case "${dpkgArch##*-}" in \ |
121 | amd64) ARCH='amd64';; \ | |
122 | *) echo "unsupported architecture"; exit 1 ;; \ | |
123 | esac \ | |
124 | && set -ex \ | |
8c37d866 | 125 | && apt-get update \ |
c52f471b | 126 | && apt-get install -y ca-certificates gnupg dirmngr --no-install-recommends \ |
8c37d866 | 127 | && rm -rf /var/lib/apt/lists/* \ |
7dcc5c4a | 128 | && export GNUPGHOME="$(mktemp -d)" \ |
c52f471b | 129 | && for key in \ |
4665aa57 | 130 | CACB9FE09150307D1D22D82962754C3B3ABCFE23 \ |
c52f471b JB |
131 | ; do \ |
132 | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/sapmachine.gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ | |
133 | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/sapmachine.gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \ | |
134 | done \ | |
135 | && chmod 644 /etc/apt/trusted.gpg.d/sapmachine.gpg \ | |
865db469 | 136 | && echo "deb http://dist.sapmachine.io/debian/${ARCH}/ ./" | tee /etc/apt/sources.list.d/sapmachine.list \ |
8c37d866 | 137 | && apt-get update \ |
3a2f4da1 | 138 | && apt-get install -y sapmachine-${SAPMACHINE_MAJOR_VERSION}-jdk=${SAPMACHINE_VERSION} --no-install-recommends \ |
7dcc5c4a | 139 | && rm -rf "$GNUPGHOME" /var/lib/apt/lists/* \ |
c52f471b | 140 | && apt-get remove --purge --autoremove -y ca-certificates gnupg dirmngr \ |
3a2f4da1 | 141 | && ln -s /usr/lib/jvm/sapmachine-${SAPMACHINE_MAJOR_VERSION} ${JAVA_HOME} \ |
8c37d866 | 142 | # smoke test |
45636150 | 143 | && java -version |
8c37d866 | 144 | |
13c4efcd | 145 | ARG MAVEN_VERSION=3.8.7 |
b4603354 | 146 | ARG BASE_URL=https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries |
403c6ed0 AV |
147 | |
148 | ENV MAVEN_HOME /usr/share/maven | |
149 | ENV M2_HOME ${MAVEN_HOME} | |
150 | ||
151 | RUN set -ex \ | |
152 | && apt-get update \ | |
b4603354 | 153 | && apt-get install -y ca-certificates curl gnupg dirmngr --no-install-recommends \ |
403c6ed0 | 154 | && rm -rf /var/lib/apt/lists/* \ |
b4603354 JB |
155 | && curl -fsSLO --compressed ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \ |
156 | && curl -fsSLO --compressed ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz.asc \ | |
7dcc5c4a | 157 | && export GNUPGHOME="$(mktemp -d)" \ |
c52f471b JB |
158 | && for key in \ |
159 | 6A814B1F869C2BBEAB7CB7271A2A1C94BDE89688 \ | |
160 | ; do \ | |
161 | gpg --batch --keyserver hkps://pgp.surf.nl --recv-keys "$key" || \ | |
162 | gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \ | |
163 | done \ | |
b4603354 | 164 | && gpg --batch --verify apache-maven-${MAVEN_VERSION}-bin.tar.gz.asc apache-maven-${MAVEN_VERSION}-bin.tar.gz \ |
403c6ed0 | 165 | && mkdir -p ${MAVEN_HOME} ${MAVEN_HOME}/ref \ |
b4603354 | 166 | && tar -xzf apache-maven-${MAVEN_VERSION}-bin.tar.gz -C ${MAVEN_HOME} --strip-components=1 \ |
d0487684 | 167 | && rm -rf "$GNUPGHOME" apache-maven-${MAVEN_VERSION}-bin.tar.gz.asc apache-maven-${MAVEN_VERSION}-bin.tar.gz \ |
27e53e8b | 168 | && chmod -R a+w ${MAVEN_HOME}/conf/* \ |
403c6ed0 | 169 | && ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn \ |
b4603354 | 170 | && apt-get remove --purge --autoremove -y ca-certificates curl gnupg dirmngr \ |
8c37d866 | 171 | # smoke test |
403c6ed0 AV |
172 | && mvn --version |
173 | ||
85a9ffe4 | 174 | ARG MBT_VERSION=1.2.21 |
8c37d866 JB |
175 | |
176 | RUN set -ex \ | |
a926492b | 177 | && npm install -g --registry=https://int.repositories.cloud.sap/artifactory/api/npm/build-releases-npm --unsafe-perm mbt@${MBT_VERSION} \ |
34672c4c | 178 | && npm cache clean -g --force \ |
8c37d866 JB |
179 | # smoke test |
180 | && mbt --version | |
181 | ||
182 | # SAP e-Mobility requirements | |
403c6ed0 AV |
183 | RUN set -ex \ |
184 | && apt-get update \ | |
43e27b30 | 185 | && apt-get install -y ca-certificates build-essential python3 --no-install-recommends \ |
403c6ed0 | 186 | && rm -rf /var/lib/apt/lists/* \ |
403c6ed0 | 187 | # smoke test |
8c37d866 | 188 | && python3 --version |
403c6ed0 AV |
189 | |
190 | WORKDIR /project | |
191 | USER ${USER} |