forked from young-yang03/cloud-mta-build-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile_mbtci_java8
130 lines (113 loc) · 5.48 KB
/
Dockerfile_mbtci_java8
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# On `22.04 LTS (Jammy Jellyfish)` the `apt-get` command fails
# https://ubuntu.com/about/release-cycle
FROM debian:bullseye-slim
#FROM ubuntu:focal
# Build time arguments
ARG DEBIAN_FRONTEND=noninteractive
ARG MTA_USER_HOME=/home/mta
ARG MBT_VERSION=1.2.19
ARG GO_VERSION=1.15.6
# node version as found in https://nodejs.org/dist/ e.g: "v16.15.0"
ARG NODE_VERSION=NODE_VERSION_TEMPLATE
ARG MAVEN_VERSION=3.8.6
# This is used to build the download URL
# e.g: https://tools.hana.ondemand.com/additional/sapjvm-8.1.086-linux-x64.zip
# note that sometimes old versions are removed and new patch versions are added
# so this argument's value may need to be updated in the future
# Also see JVM section here:
# - https://tools.hana.ondemand.com/#cloud
ARG JAVA_VERSION=JAVA_VERSION_TEMPLATE
# Environment variables
ENV JAVA_HOME /opt/jdk
ENV MAVEN_HOME /usr/apache-maven-$MAVEN_VERSION
ENV PATH $PATH:$MAVEN_HOME/bin:${JAVA_HOME}/bin
ENV PYTHON /usr/bin/python3
ENV M2_HOME=/opt/maven/apache-maven-${MAVEN_VERSION}
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV DEBIAN_FRONTEND=noninteractive
ADD http://aia.pki.co.sap.com/aia/SAP%20Global%20Root%20CA.crt \
/etc/ssl/certs/SAP_Global_Root_CA.crt
# Download required env tools
RUN apt-get update && \
apt-get install --yes --no-install-recommends \
ca-certificates \
git \
make \
curl \
wget \
unzip \
libarchive-tools && \
# Change security level as the SAP npm repo doesnt support buster new security upgrade
# the default configuration for OpenSSL in Buster explicitly requires using more secure ciphers and protocols,
# and the server running at http://npm.sap.com/ is running software configured to only provide insecure, older ciphers.
# This causes SSL connections using OpenSSL from a Buster based installation to fail
# Should be remove once SAP npm repo will patch the security level
# see - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=912759
sed -i -E 's/(CipherString\s*=\s*DEFAULT@SECLEVEL=)2/\11/' /etc/ssl/openssl.cnf && \
# install java
mkdir -p /opt && \
echo "Downloading sapjvm-${JAVA_VERSION}-linux-x64.zip" && \
# wget --no-check-certificate --no-cookies --header "Cookie: eula_3_1_agreed=tools.hana.ondemand.com/developer-license-3_1.txt; path=/;" -S https://tools.hana.ondemand.com/additional/sapjvm-${JAVA_VERSION}-linux-x64.zip && \
# unzip sapjvm-${JAVA_VERSION}-linux-x64.zip -d /usr/local/ && \
curl -fsSLO --compressed -b 'eula_3_1_agreed=tools.hana.ondemand.com/developer-license-3_1.txt' https://tools.hana.ondemand.com/additional/sapjvm-${JAVA_VERSION}-linux-x64.zip && \
echo "583dedfeee0c119839a610ddc8c6768d0c044429 sapjvm-${JAVA_VERSION}-linux-x64.zip" | sha1sum -c - && \
# unzip sapjvm-${JAVA_VERSION}-linux-x64.zip -d /usr/local/ && \
bsdtar -xvf sapjvm-${JAVA_VERSION}-linux-x64.zip -C /usr/local --strip-components=1 && \
ln -s /usr/local/sapjvm_8 /opt/jdk && \
rm sapjvm-${JAVA_VERSION}-linux-x64.zip && \
# install node
NODE_HOME=/opt/nodejs; mkdir -p ${NODE_HOME} && \
echo "Start download node: https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" && \
curl --fail --silent --output - "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" \
| tar -xzv -f - -C "${NODE_HOME}" && \
echo "End download node" && \
ln -s "${NODE_HOME}/node-v${NODE_VERSION}-linux-x64/bin/node" /usr/local/bin/node && \
ln -s "${NODE_HOME}/node-v${NODE_VERSION}-linux-x64/bin/npm" /usr/local/bin/npm && \
ln -s "${NODE_HOME}/node-v${NODE_VERSION}-linux-x64/bin/npx" /usr/local/bin/ && \
chmod --recursive a+w "${NODE_HOME}" && \
# install grunt-cli
npm install --prefix /usr/local/ -g grunt-cli && \
# install ui5-cli temporary solution
npm install --prefix /usr/local/ -g @ui5/cli && \
# installing Golang
curl -O https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz && tar -xvf go${GO_VERSION}.linux-amd64.tar.gz && \
mv go /usr/local && \
mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" && \
mkdir -p ${GOPATH}/src ${GOPATH}/bin && \
# update maven home
M2_BASE="$(dirname ${M2_HOME})" && \
mkdir -p "${M2_BASE}" && \
curl --fail --silent --output - "https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" \
| tar -xzvf - -C "${M2_BASE}" && \
ln -s "${M2_HOME}/bin/mvn" /usr/local/bin/mvn && \
chmod --recursive a+w "${M2_HOME}"/conf/* && \
# Download MBT
curl -L "https://github.com/SAP/cloud-mta-build-tool/releases/download/v${MBT_VERSION}/cloud-mta-build-tool_${MBT_VERSION}_Linux_amd64.tar.gz" | tar -zx -C /usr/local/bin && \
chown root:root /usr/local/bin/mbt && \
# handle users permission
useradd --home-dir "${MTA_USER_HOME}" \
--create-home \
--shell /bin/bash \
--user-group \
--uid 1000 \
--comment 'Cloud MTA Build Tool' \
--password "$(echo weUseMta |openssl passwd -1 -stdin)" mta && \
# allow anybody to write into the images HOME
chmod a+w "${MTA_USER_HOME}" && \
# Install essential build tools and python, required for building db modules
apt-get install --yes --no-install-recommends \
build-essential \
python2.7 \
python3 && \
# remove build env tools
apt-get remove --purge --autoremove --yes \
curl \
wget \
unzip && \
rm -rf /var/lib/apt/lists/*
ENV PATH=$PATH:./node_modules/.bin HOME=${MTA_USER_HOME}
WORKDIR /project
USER mta