1
- FROM debian:bullseye-slim as stage-wisp-build
2
- ARG TARGETARCH
3
-
4
- ARG DEPENDENCIES=" \
5
- ca-certificates \
6
- wget"
7
-
8
- ARG APT_MIRROR=http://mirrors.ustc.edu.cn
9
- RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=chen \
10
- --mount=type=cache,target=/var/lib/apt,sharing=locked,id=chen \
11
- set -ex \
12
- && rm -f /etc/apt/apt.conf.d/docker-clean \
13
- && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache \
14
- && sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
15
- && apt-get update \
16
- && apt-get -y install --no-install-recommends ${DEPENDENCIES} \
17
- && echo "no" | dpkg-reconfigure dash \
18
- && apt-get clean all \
19
- && rm -rf /var/lib/apt/lists/*
20
-
21
- WORKDIR /opt
22
-
23
- ARG CHECK_VERSION=v1.0.2
24
- RUN set -ex \
25
- && wget https://github.com/jumpserver-dev/healthcheck/releases/download/${CHECK_VERSION}/check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz \
26
- && tar -xf check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz \
27
- && mv check /usr/local/bin/ \
28
- && chown root:root /usr/local/bin/check \
29
- && chmod 755 /usr/local/bin/check \
30
- && rm -f check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz
31
-
32
- ARG WISP_VERSION=v0.1.21
33
- RUN set -ex \
34
- && wget https://github.com/jumpserver/wisp/releases/download/${WISP_VERSION}/wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz \
35
- && tar -xf wisp-${WISP_VERSION}-linux-${TARGETARCH}.tar.gz -C /usr/local/bin/ --strip-components=1 \
36
- && chown root:root /usr/local/bin/wisp \
37
- && chmod 755 /usr/local/bin/wisp \
38
- && rm -f /opt/*.tar.gz
39
-
40
- from node:16.20-bullseye-slim as stage-web-build
41
- ARG TARGETARCH
42
- ARG NPM_REGISTRY="https://registry.npmmirror.com"
43
-
44
- RUN set -ex \
45
- && npm config set registry ${NPM_REGISTRY} \
46
- && yarn config set registry ${NPM_REGISTRY}
47
-
48
- WORKDIR /opt/chen/frontend
49
-
50
- RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=chen \
51
- --mount=type=bind,source=frontend/package.json,target=package.json \
52
- --mount=type=bind,source=frontend/yarn.lock,target=yarn.lock \
53
- yarn install
54
-
55
- ADD frontend .
56
-
57
- RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=chen \
58
- yarn build
59
-
60
- FROM debian:bullseye-slim as stage-chen-build
61
- ARG TARGETARCH
62
-
63
- ARG DEPENDENCIES=" \
64
- ca-certificates \
65
- curl \
66
- openjdk-17-jre-headless"
67
-
68
- ARG APT_MIRROR=http://mirrors.ustc.edu.cn
69
- RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=chen \
70
- --mount=type=cache,target=/var/lib/apt,sharing=locked,id=chen \
71
- set -ex \
72
- && rm -f /etc/apt/apt.conf.d/docker-clean \
73
- && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache \
74
- && sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
75
- && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
76
- && apt-get update \
77
- && apt-get install -y --no-install-recommends ${DEPENDENCIES} \
78
- && echo "no" | dpkg-reconfigure dash
79
-
80
- ARG MAVEN_VERSION=3.9.7
81
- ARG USER_HOME_DIR="/root"
82
- ARG BASE_URL=https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries
83
-
84
- RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
85
- && curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
86
- && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
87
- && rm -f /tmp/apache-maven.tar.gz \
88
- && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
89
-
90
- ENV MAVEN_HOME /usr/share/maven
91
- ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
92
-
93
- WORKDIR /opt/chen
1
+ FROM jumpserver/chen-base:20240808_094305 AS stage-build
2
+ ENV LANG=en_US.UTF-8
94
3
4
+ WORKDIR /opt/chen/
95
5
COPY . .
96
- COPY --from=stage-web-build /opt/chen/frontend/dist frontend/dist
97
-
98
- ARG VERSION
99
- ENV VERSION=$VERSION
100
6
101
- ARG MAVEN_MIRROR=https://repo.maven.apache.org/maven2
102
- RUN --mount=type=cache,target=/root/.m2,id=chen \
103
- set -ex \
104
- && mkdir -p /root/.m2 \
105
- && sed -i "s@https://repo.maven.apache.org/maven2@${MAVEN_MIRROR}@g" settings.xml \
106
- && \c p -f settings.xml /root/.m2/ \
107
- && mvn clean package -DskipTests
7
+ RUN cd frontend \
8
+ && npm run build
108
9
109
- RUN chmod +x entrypoint.sh
10
+ RUN mvn clean package -DskipTests
110
11
111
12
FROM debian:bullseye-slim
112
- ARG TARGETARCH
113
- ENV LANG=en_US.UTF-8
114
13
115
14
ARG DEPENDENCIES=" \
116
15
ca-certificates \
117
16
openjdk-17-jre-headless"
118
17
119
- ARG APT_MIRROR=http://mirrors.ustc.edu.cn
120
- RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=chen \
121
- --mount=type=cache,target=/var/lib/apt,sharing=locked,id=chen \
122
- sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
18
+ ARG APT_MIRROR=http://deb.debian.org
19
+ RUN sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
123
20
&& rm -f /etc/apt/apt.conf.d/docker-clean \
124
21
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
125
22
&& apt-get update \
@@ -131,13 +28,13 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=chen \
131
28
132
29
WORKDIR /opt/chen
133
30
134
- COPY --from=stage-wisp- build /usr/local/bin /usr/local/bin
135
- COPY --from=stage-chen- build /opt/chen/backend/web/target/web-*.jar /opt/chen/chen.jar
136
- COPY --from=stage-chen- build /opt/chen/entrypoint.sh .
137
- COPY --from=stage-chen- build /opt/chen/drivers /opt/chen/drivers
138
- COPY --from=stage-chen- build /opt/chen/config/application.yml /opt/chen/config/application.yml
31
+ COPY --from=stage-build /usr/local/bin/check /usr/local/bin/wisp /usr/local/bin/
32
+ COPY --from=stage-build /opt/chen/backend/web/target/web-*.jar /opt/chen/chen.jar
33
+ COPY --from=stage-build /opt/chen/entrypoint.sh .
34
+ COPY --from=stage-build /opt/chen/drivers /opt/chen/drivers
35
+ COPY --from=stage-build /opt/chen/config/application.yml /opt/chen/config/application.yml
139
36
140
- ARG VERSION
37
+ ARG VERSION=dev
141
38
ENV VERSION=$VERSION
142
39
143
40
VOLUME /opt/chen/data
@@ -148,4 +45,4 @@ EXPOSE 8082
148
45
149
46
STOPSIGNAL SIGQUIT
150
47
151
- CMD [ "wisp" ]
48
+ CMD [ "wisp" ]
0 commit comments