forked from bpmct/jetbrains-indexer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
245 lines (208 loc) · 9.81 KB
/
Dockerfile
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# Comment out the CMD line and uncomment the following for testing
# ENTRYPOINT ["tail", "-f", "/dev/null"]
FROM ubuntu:22.04
MAINTAINER Rick "rick@dockergiant.com"
ENV DEBIAN_FRONTEND noninteractive
ARG TARGETARCH
#### ---------------------
#### ---- USER, GROUP ----
#### ---------------------
ENV USER_ID=${USER_ID:-1000}
ENV GROUP_ID=${GROUP_ID:-1000}
ENV JAVA_VERSION=19
ENV LANG C.UTF-8
ARG LIB_BASIC_LIST="curl wget unzip ca-certificates"
RUN set -eux; \
apt-get update -y && \
apt-get install -y ${LIB_BASIC_LIST}
########################################
#### update ubuntu and Install Python 3
########################################
ARG LIB_DEV_LIST="apt-utils automake pkg-config libpcre3-dev zlib1g-dev liblzma-dev"
ARG LIB_BASIC_LIST="curl iputils-ping nmap net-tools build-essential software-properties-common apt-transport-https"
ARG LIB_COMMON_LIST="bzip2 libbz2-dev git wget unzip vim python3-pip python3-setuptools python3-dev python3-venv python3-numpy python3-scipy python3-pandas python3-matplotlib"
ARG LIB_TOOL_LIST="graphviz libsqlite3-dev sqlite3 git xz-utils"
RUN apt-get update -y && \
apt-get install -yq ${LIB_DEV_LIST} && \
apt-get install -yq ${LIB_BASIC_LIST} && \
apt-get install -yq ${LIB_COMMON_LIST} && \
apt-get install -yq ${LIB_TOOL_LIST} && \
apt-get install -yq sudo && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
########################################
#### ------- OpenJDK Installation ------
########################################
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
# A few reasons for installing distribution-provided OpenJDK:
#
# 1. Oracle. Licensing prevents us from redistributing the official JDK.
#
# 2. Compiling OpenJDK also requires the JDK to be installed, and it gets
# really hairy.
#
# For some sample build times, see Debian's buildd logs:
# https://buildd.debian.org/status/logs.php?pkg=openjdk-8
RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
unzip \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Default to UTF-8 file.encoding
ENV LANG C.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/java-${JAVA_VERSION}-openjdk-${TARGETARCH}
ENV PATH=$JAVA_HOME/bin:$PATH
# ------------------
# OpenJDK Java:
# ------------------
ARG OPENJDK_PACKAGE=${OPENJDK_PACKAGE:-openjdk-${JAVA_VERSION}-jdk}
ARG OPENJDK_INSTALL_LIST="${OPENJDK_PACKAGE}"
RUN apt-get update -y && \
apt-get install -y ${OPENJDK_INSTALL_LIST} && \
ls -al ${JAVA_HOME} && \
export PATH=$PATH ; echo "PATH=${PATH}" ; export JAVA_HOME=${JAVA_HOME} ; echo "java=`which java`" && \
rm -rf /var/lib/apt/lists/*
## ------------------------------------------------------------------------------------------------
## update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java
## ... and verify that it actually worked for one of the alternatives we care about
## ------------------------------------------------------------------------------------------------
#RUN update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \
# update-alternatives --query java | grep -q 'Status: manual'
###################################
#### ---- Install Maven 3 ---- ####
###################################
ENV MAVEN_VERSION=${MAVEN_VERSION:-3.9.2}
ENV MAVEN_HOME=/usr/apache-maven-${MAVEN_VERSION}
ENV MAVEN_PACKAGE=apache-maven-${MAVEN_VERSION}-bin.tar.gz
ENV PATH=${PATH}:${MAVEN_HOME}/bin
## -- Auto tracking (by parsing product release page) the latest release -- ##
# https://dlcdn.apache.org/maven/maven-3/3.9.2/binaries/apache-maven-3.9.2-bin.tar.gz
RUN export MAVEN_PACKAGE_URL=$(curl -s https://maven.apache.org/download.cgi | grep -e "apache-maven.*bin.tar.gz" | head -1 | cut -d'"' -f2) && \
export MAVEN_PACKAGE=$(basename $MAVEN_PACKAGE_URL) && \
export MAVEN_VERSION=$(echo ${MAVEN_PACKAGE}|cut -d'-' -f3) && \
export MAVEN_HOME=/usr/apache-maven-${MAVEN_VERSION} && \
export PATH=${PATH}:${MAVEN_HOME}/bin && \
curl -k -sL ${MAVEN_PACKAGE_URL} | gunzip | tar x -C /usr/ && \
ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn && \
rm -f ${MAVEN_PACKAGE}
RUN python3 -m pip install --upgrade pip
## -- added Local PIP installation bin to PATH
ENV PATH=${PATH}:${HOME}/.local/bin
## VERSIONS ##
ENV PATH=${PATH}:${JAVA_HOME}/bin
RUN mvn --version && \
python3 -V && \
pip3 --version
###################################
#### ---- Install Gradle ---- #####
###################################
# Ref: https://gradle.org/releases/
ENV GRADLE_INSTALL_BASE=${GRADLE_INSTALL_BASE:-/opt/gradle}
ENV GRADLE_VERSION=${GRADLE_VERSION:-8.1.1}
ENV GRADLE_PACKAGE=gradle-${GRADLE_VERSION}-bin.zip
ENV GRADLE_PACKAGE_URL=https://services.gradle.org/distributions/${GRADLE_PACKAGE}
ENV GRADLE_HOME=${GRADLE_INSTALL_BASE}/gradle-${GRADLE_VERSION}
ENV PATH=${PATH}:${GRADLE_HOME}/bin
# export GRADLE_PACKAGE_URL=$(curl -s https://gradle.org/releases/ | grep "Download: " | cut -d'"' -f4 | sort -u | tail -1) && \
## -- Auto tracking (by parsing product release page) the latest release -- ##
RUN mkdir -p ${GRADLE_INSTALL_BASE} && \
cd ${GRADLE_INSTALL_BASE} && \
export GRADLE_PACKAGE_URL=$(curl -k -s https://gradle.org/releases/ | grep "Download: " | head -1 | cut -d'"' -f4) && \
export GRADLE_PACKAGE=$(basename ${GRADLE_PACKAGE_URL}) && \
export GRADLE_VERSION=$(echo $GRADLE_PACKAGE|cut -d'-' -f2) && \
export GRADLE_HOME=${GRADLE_INSTALL_BASE}/gradle-${GRADLE_VERSION} && \
export PATH=${PATH}:${GRADLE_HOME}/bin && \
wget -q --no-check-certificate -c ${GRADLE_PACKAGE_URL} && \
unzip -d ${GRADLE_INSTALL_BASE} ${GRADLE_PACKAGE} && \
ls -al ${GRADLE_HOME} && \
ln -s ${GRADLE_HOME}/bin/gradle /usr/bin/gradle && \
${GRADLE_HOME}/bin/gradle -v && \
rm -f ${GRADLE_PACKAGE}
#########################################
#### ---- Node from NODESOURCES ---- ####
#########################################
# Ref: https://github.com/nodesource/distributions
#ARG NODE_VERSION=${NODE_VERSION:-current}
# Ubuntu 22.04
ARG NODE_VERSION=${NODE_VERSION:-20}
ENV NODE_VERSION=${NODE_VERSION}
RUN apt-get update && \
apt-get install -y curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update -y && \
apt-get install -y nodejs
########################
#### ---- Yarn ---- ####
########################
# Ref: https://classic.yarnpkg.com/en/docs/install/#debian-stable
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list && \
apt-get update -y && \
apt-get install -y yarn
###################################
#### ---- Update: all ---- ####
###################################
RUN apt-get update -y && apt-get upgrade -y
# Shared indexing works best
# when you use the IDE
# corresponding to the language
# your project is in
ARG IDE=PhpStorm
ARG IDE_SHORT=phpstorm
ARG IDE_CODE=webide
ARG IDE_VERSION=2023.2
# persist build args for runtime
# see https://www.saltycrane.com/blog/2021/04/buildtime-vs-runtime-environment-variables-nextjs-docker/#setting-dynamic-buildtime-environment-variables-that-are-available-at-runtime-also
ENV IDE=$IDE
ENV IDE_SHORT=$IDE_SHORT
ENV IDE_CODE=$IDE_CODE
ENV IDE_VERSION=$IDE_VERSION
ARG IDE_TAR=${IDE}-${IDE_VERSION}.tar.gz
ARG SHARED_INDEX_CLI_TOOL_VERSION=0.9.8
# Runtime variables
ENV IDEA_PROJECT_DIR="/var/project"
ENV PROJECT_NAME=''
ENV SHARED_INDEX_BASE="/shared-index"
USER root
WORKDIR /opt
# Set up folders
RUN mkdir -p /etc/idea && \
mkdir -p /etc/idea/config && \
mkdir -p /etc/idea/log && \
mkdir -p /etc/idea/plugins && \
mkdir -p /etc/idea/system && \
mkdir ${SHARED_INDEX_BASE} && \
mkdir ${SHARED_INDEX_BASE}/output && \
mkdir ${SHARED_INDEX_BASE}/temp
# Install IntelliJ IDEA Ultimate
# arm64 package url : https://download.jetbrains.com/webide/PhpStorm-2023.1.2-aarch64.tar.gz
RUN if [ "${TARGETARCH}" = "arm64" ]; then IDE_TAR="${IDE}-${IDE_VERSION}-aarch64.tar.gz"; fi && \
wget -nv https://download-cf.jetbrains.com/${IDE_CODE}/${IDE_TAR} && \
tar xzf ${IDE_TAR} && \
tar tzf ${IDE_TAR} | head -1 | sed -e 's/\/.*//' | xargs -I{} ln -s {} idea && \
rm ${IDE_TAR} && \
echo idea.config.path=/etc/idea/config >> /opt/idea/bin/idea.properties && \
echo idea.log.path=/etc/idea/log >> /opt/idea/bin/idea.properties && \
echo idea.plugins.path=/etc/idea/plugins >> /opt/idea/bin/idea.properties && \
echo idea.system.path=/etc/idea/system >> /opt/idea/bin/idea.properties && \
chmod -R 777 /opt/idea && \
chmod -R 777 ${SHARED_INDEX_BASE} && \
chmod -R 777 /etc/idea
# Install ij-shared-indexes-tool-cli
RUN wget https://packages.jetbrains.team/maven/p/ij/intellij-shared-indexes/com/jetbrains/intellij/indexing/shared/ij-shared-indexes-tool-cli/0.9.8/ij-shared-indexes-tool-cli-0.9.8.zip -O ij-shared-indexes-tool-cli.zip && \
unzip ij-shared-indexes-tool-cli.zip && \
rm ij-shared-indexes-tool-cli.zip && \
mv ij-shared-indexes-tool-cli-${SHARED_INDEX_CLI_TOOL_VERSION} ij-shared-indexes-tool-cli
###################################
#### ---- Clean not used files ---- ####
###################################
RUN apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh entrypoint.sh
CMD ./entrypoint.sh
# Comment out the CMD line and uncomment the following for testing
# ENTRYPOINT ["tail", "-f", "/dev/null"]