-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile-base
75 lines (64 loc) · 2.86 KB
/
Dockerfile-base
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
FROM node:20.15-bullseye-slim
ARG TARGETARCH
# Install linux dependencies
ARG DEPENDENCIES=" \
ca-certificates \
openjdk-17-jre-headless \
curl \
wget"
ARG APT_MIRROR=http://deb.debian.org
RUN set -ex \
&& rm -f /etc/apt/apt.conf.d/docker-clean \
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \
&& sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
&& apt-get update \
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
&& echo "no" | dpkg-reconfigure dash \
&& apt-get clean all \
&& rm -rf /var/lib/apt/lists/*
# Install tools and dependencies
ARG CHECK_VERSION=v1.0.3
RUN set -ex \
&& wget https://github.com/jumpserver-dev/healthcheck/releases/download/${CHECK_VERSION}/check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz \
&& tar -xf check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz \
&& mv check /usr/local/bin/ \
&& chown root:root /usr/local/bin/check \
&& chmod 755 /usr/local/bin/check \
&& rm -f check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz
ARG WISP_VERSION=v0.2.2
RUN set -ex \
&& wget https://github.com/jumpserver/wisp/releases/download/${WISP_VERSION}/wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz \
&& tar -xf wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz -C /usr/local/bin/ --strip-components=1 \
&& chown root:root /usr/local/bin/wisp \
&& chmod 755 /usr/local/bin/wisp \
&& rm -f /opt/*.tar.gz
# Install NPM dependencies
WORKDIR /opt/chen/frontend
COPY frontend/package.json frontend/package-lock.json frontend/yarn.lock ./
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=chen \
npm install
# Install Maven dependencies
ARG MAVEN_VERSION=3.9.7
ARG USER_HOME_DIR="/root"
ARG BASE_URL=https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries
ARG MAVEN_MIRROR=https://repo.maven.apache.org/maven2
ENV MAVEN_HOME=/usr/share/maven
ENV MAVEN_CONFIG="$USER_HOME_DIR/.m2"
WORKDIR /opt/chen
COPY settings.xml pom.xml ./
COPY backend/pom.xml backend/
COPY backend/framework/pom.xml backend/framework/
COPY backend/web/pom.xml backend/web/
COPY backend/wisp/pom.xml backend/wisp/
COPY backend/modules/pom.xml backend/modules/
RUN set -ex \
&& mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn \
&& mkdir -p /root/.m2 \
&& mkdir -p /opt/chen/frontend/dist \
&& sed -i "s@https://repo.maven.apache.org/maven2@${MAVEN_MIRROR}@g" settings.xml \
&& \cp -f settings.xml /root/.m2/ \
&& mvn clean install