Jpom/modules/server/Dockerfile

101 lines
3.4 KiB
Docker
Raw Normal View History

#
# The MIT License (MIT)
#
2021-12-14 19:20:00 +08:00
# Copyright (c) 2019 Code Technology Studio
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
2021-12-31 18:44:56 +08:00
2021-12-31 10:05:50 +08:00
# syntax = docker/dockerfile:experimental
2022-03-31 17:46:18 +08:00
FROM maven:3.8.5-jdk-8-slim as builder
2021-12-30 21:46:42 +08:00
WORKDIR /target/dependency
COPY . .
VOLUME ["/root/.m2","/target/dependency/web-vue/node_modules"]
# 多次 builder 不同的版本号
ARG TEMP_VERSION=""
ARG JPOM_VERSION
ENV USE_JPOM_VERSION=${JPOM_VERSION}${TEMP_VERSION}
2023-04-04 18:22:28 +08:00
RUN --mount=type=cache,target=/root/.m2 bash ./script/replaceVersion.sh "${USE_JPOM_VERSION}" "release"
2022-11-17 21:56:15 +08:00
ENV NODE_VERSION 16.13.1
2021-12-30 21:46:42 +08:00
RUN set -eux; \
ARCH="$(dpkg --print-architecture)"; \
case "${ARCH}" in \
aarch64|arm64) \
BINARY_ARCH='arm64'; \
;; \
amd64|x86_64) \
BINARY_ARCH='x64'; \
;; \
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac; \
2022-11-17 21:56:15 +08:00
curl -LfsSo /opt/node-v${NODE_VERSION}-linux-${BINARY_ARCH}.tar.gz https://npmmirror.com/mirrors/node/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${BINARY_ARCH}.tar.gz \
&& tar -zxvf /opt/node-v${NODE_VERSION}-linux-${BINARY_ARCH}.tar.gz -C /usr/local --strip-components=1 \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& npm config set registry https://registry.npmmirror.com/
RUN --mount=type=cache,target=/target/dependency/web-vue/node_modules cd web-vue && npm install && npm run build
2021-12-30 21:46:42 +08:00
RUN --mount=type=cache,target=/root/.m2 mvn -B -e -T 1C clean package -pl modules/server -am -Dmaven.test.skip=true -Dmaven.compile.fork=true -s script/settings.xml
2021-12-30 21:46:42 +08:00
2022-03-31 17:46:18 +08:00
FROM maven:3.8.5-jdk-8
2022-11-17 21:56:15 +08:00
ARG BUILD_DATE
ARG JPOM_VERSION
ARG TEMP_VERSION=""
ARG DEPENDENCY=/target/dependency
2022-11-17 21:56:15 +08:00
LABEL build_info="dromara/Jpom build-date:- ${BUILD_DATE}"
LABEL maintainer="bwcx-jzy <bwcx_jzy@163.com>"
LABEL documentation="https://jpom.top"
2021-12-30 21:46:42 +08:00
ENV JPOM_HOME /usr/local/jpom-server
ENV JPOM_PKG_VERSION ${JPOM_VERSION}${TEMP_VERSION}
ENV JPOM_PKG server-${JPOM_PKG_VERSION}-release
ENV JPOM_DATA_PATH ${JPOM_HOME}/data
2023-01-05 13:16:59 +08:00
ENV JPOM_LOG_PATH ${JPOM_HOME}/logs
2021-12-30 21:46:42 +08:00
WORKDIR $JPOM_HOME
2021-12-30 21:46:42 +08:00
COPY --from=builder ${DEPENDENCY}/modules/server/target/${JPOM_PKG} ${JPOM_HOME}
2021-12-08 16:10:39 +08:00
2023-04-13 13:02:38 +08:00
RUN apt-get install -y git
# 时区
ENV TZ Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 数据目录
ENV jpom.path ${JPOM_DATA_PATH}
VOLUME $JPOM_DATA_PATH $JPOM_LOG_PATH
2021-12-30 21:46:42 +08:00
EXPOSE 2122
2021-12-08 16:10:39 +08:00
2022-11-17 21:56:15 +08:00
HEALTHCHECK CMD curl -X POST -f http://localhost:2122/check-system || exit 1
ENTRYPOINT ["/bin/bash", "./bin/BlockListener.sh"]
2021-12-30 16:24:26 +08:00
2021-12-08 16:10:39 +08:00