Ensure java smoke test work with all versions
[mbt-docker.git] / Dockerfile
... / ...
CommitLineData
1FROM debian:bullseye-slim
2
3ARG USER="mta"
4ARG USER_HOME_DIR="/home/${USER}"
5ENV HOME ${USER_HOME_DIR}
6
7RUN set -ex \
8 && apt-get update \
9 && apt-get install -y openssl --no-install-recommends \
10 && rm -rf /var/lib/apt/lists/* \
11 # smoke test
12 && openssl version \
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} \
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
23
24ADD http://aia.pki.co.sap.com/aia/SAP%20Global%20Root%20CA.crt \
25 /etc/ssl/certs/SAP_Global_Root_CA.crt
26
27ARG NODE_VERSION=16.18.1
28
29RUN 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
42 && apt-get install -y ca-certificates curl gnupg dirmngr xz-utils libatomic1 --no-install-recommends \
43 && rm -rf /var/lib/apt/lists/* \
44 && export GNUPGHOME="$(mktemp -d)" \
45 && for key in \
46 4ED778F539E3634C779C87C6D7062848A1AB005C \
47 141F07595B7B3FFE74309A937405533BE57C7D57 \
48 74F12602B6F1C4E913FAA37AD3A89613643B6201 \
49 61FC681DFB92A079F1685E77973F295594EC4689 \
50 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
51 C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
52 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \
53 C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \
54 108F52B48DB57BB0CC439B2997B01419BD92F80A \
55 ; do \
56 gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \
57 gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \
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 \
64 && rm -rf "$GNUPGHOME" "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
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
79ARG YARN_VERSION=1.22.19
80
81RUN set -ex \
82 && savedAptMark="$(apt-mark showmanual)" \
83 && apt-get update \
84 && apt-get install -y ca-certificates curl gnupg dirmngr --no-install-recommends \
85 && rm -rf /var/lib/apt/lists/* \
86 && export GNUPGHOME="$(mktemp -d)" \
87 && for key in \
88 6A010C5166006599AA17F08146C2130DFD2497F5 \
89 ; do \
90 gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \
91 gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \
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 \
100 && rm -rf "$GNUPGHOME" yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
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
114ARG SAPMACHINE_VERSION=11.0.17
115
116RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
117 && case "${dpkgArch##*-}" in \
118 amd64) ARCH='amd64';; \
119 *) echo "unsupported architecture"; exit 1 ;; \
120 esac \
121 && set -ex \
122 && apt-get update \
123 && apt-get install -y ca-certificates gnupg dirmngr --no-install-recommends \
124 && rm -rf /var/lib/apt/lists/* \
125 && export GNUPGHOME="$(mktemp -d)" \
126 && for key in \
127 CACB9FE09150307D1D22D82962754C3B3ABCFE23 \
128 ; do \
129 gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/sapmachine.gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \
130 gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/sapmachine.gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \
131 done \
132 && chmod 644 /etc/apt/trusted.gpg.d/sapmachine.gpg \
133 && echo "deb http://dist.sapmachine.io/debian/${ARCH}/ ./" | tee /etc/apt/sources.list.d/sapmachine.list \
134 && apt-get update \
135 && apt-get install -y sapmachine-$(echo ${SAPMACHINE_VERSION} | cut -d. -f1)-jdk=${SAPMACHINE_VERSION} --no-install-recommends \
136 && rm -rf "$GNUPGHOME" /var/lib/apt/lists/* \
137 && apt-get remove --purge --autoremove -y ca-certificates gnupg dirmngr \
138 # smoke test
139 && java -version
140
141ARG MAVEN_VERSION=3.8.6
142ARG BASE_URL=https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries
143
144ENV MAVEN_HOME /usr/share/maven
145ENV M2_HOME ${MAVEN_HOME}
146
147RUN set -ex \
148 && apt-get update \
149 && apt-get install -y ca-certificates curl gnupg dirmngr --no-install-recommends \
150 && rm -rf /var/lib/apt/lists/* \
151 && curl -fsSLO --compressed ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
152 && curl -fsSLO --compressed ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz.asc \
153 && export GNUPGHOME="$(mktemp -d)" \
154 && for key in \
155 6A814B1F869C2BBEAB7CB7271A2A1C94BDE89688 \
156 ; do \
157 gpg --batch --keyserver hkps://pgp.surf.nl --recv-keys "$key" || \
158 gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \
159 done \
160 && gpg --batch --verify apache-maven-${MAVEN_VERSION}-bin.tar.gz.asc apache-maven-${MAVEN_VERSION}-bin.tar.gz \
161 && mkdir -p ${MAVEN_HOME} ${MAVEN_HOME}/ref \
162 && tar -xzf apache-maven-${MAVEN_VERSION}-bin.tar.gz -C ${MAVEN_HOME} --strip-components=1 \
163 && rm -rf "$GNUPGHOME" apache-maven-${MAVEN_VERSION}-bin.tar.gz.asc apache-maven-${MAVEN_VERSION}-bin.tar.gz \
164 && chmod -R a+w ${MAVEN_HOME}/conf/* \
165 && ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn \
166 && apt-get remove --purge --autoremove -y ca-certificates curl gnupg dirmngr \
167 # smoke test
168 && mvn --version
169
170ARG MBT_VERSION=1.2.20
171
172RUN set -ex \
173 && npm install -g --registry=https://int.repositories.cloud.sap/artifactory/api/npm/build-releases-npm --unsafe-perm mbt@${MBT_VERSION} \
174 && npm cache clean -g --force \
175 # smoke test
176 && mbt --version
177
178# SAP e-Mobility requirements
179RUN set -ex \
180 && apt-get update \
181 && apt-get install -y ca-certificates build-essential python3 --no-install-recommends \
182 && rm -rf /var/lib/apt/lists/* \
183 # smoke test
184 && python3 --version
185
186WORKDIR /project
187USER ${USER}