|
|
@ -1,4 +1,4 @@
|
|
|
|
FROM python:3.11-slim-bullseye as stage-build
|
|
|
|
FROM python:3.11-slim-bullseye as stage-1
|
|
|
|
ARG TARGETARCH
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
|
|
|
|
|
|
|
ARG VERSION
|
|
|
|
ARG VERSION
|
|
|
@ -6,9 +6,10 @@ ENV VERSION=$VERSION
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /opt/jumpserver
|
|
|
|
WORKDIR /opt/jumpserver
|
|
|
|
ADD . .
|
|
|
|
ADD . .
|
|
|
|
RUN cd utils && bash -ixeu build.sh
|
|
|
|
RUN echo > /opt/jumpserver/config.yml \
|
|
|
|
|
|
|
|
&& cd utils && bash -ixeu build.sh
|
|
|
|
|
|
|
|
|
|
|
|
FROM python:3.11-slim-bullseye
|
|
|
|
FROM python:3.11-slim-bullseye as stage-2
|
|
|
|
ARG TARGETARCH
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
|
|
|
|
|
|
|
ARG BUILD_DEPENDENCIES=" \
|
|
|
|
ARG BUILD_DEPENDENCIES=" \
|
|
|
@ -31,6 +32,51 @@ ARG DEPENDENCIES=" \
|
|
|
|
freerdp2-dev \
|
|
|
|
freerdp2-dev \
|
|
|
|
libaio-dev"
|
|
|
|
libaio-dev"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARG TOOLS=" \
|
|
|
|
|
|
|
|
ca-certificates \
|
|
|
|
|
|
|
|
curl \
|
|
|
|
|
|
|
|
default-libmysqlclient-dev \
|
|
|
|
|
|
|
|
default-mysql-client \
|
|
|
|
|
|
|
|
git \
|
|
|
|
|
|
|
|
git-lfs \
|
|
|
|
|
|
|
|
unzip \
|
|
|
|
|
|
|
|
xz-utils \
|
|
|
|
|
|
|
|
wget"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARG APT_MIRROR=http://mirrors.ustc.edu.cn
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=core \
|
|
|
|
|
|
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=core \
|
|
|
|
|
|
|
|
sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
|
|
|
|
|
|
|
|
&& rm -f /etc/apt/apt.conf.d/docker-clean \
|
|
|
|
|
|
|
|
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
|
|
|
|
|
|
|
&& apt-get update \
|
|
|
|
|
|
|
|
&& apt-get -y install --no-install-recommends ${BUILD_DEPENDENCIES} \
|
|
|
|
|
|
|
|
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
|
|
|
|
|
|
|
|
&& apt-get -y install --no-install-recommends ${TOOLS} \
|
|
|
|
|
|
|
|
&& echo "no" | dpkg-reconfigure dash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /opt/jumpserver
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARG PIP_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/root/.cache \
|
|
|
|
|
|
|
|
--mount=type=bind,source=poetry.lock,target=/opt/jumpserver/poetry.lock \
|
|
|
|
|
|
|
|
--mount=type=bind,source=pyproject.toml,target=/opt/jumpserver/pyproject.toml \
|
|
|
|
|
|
|
|
set -ex \
|
|
|
|
|
|
|
|
&& python3 -m venv /opt/py3 \
|
|
|
|
|
|
|
|
&& . /opt/py3/bin/activate \
|
|
|
|
|
|
|
|
&& pip install poetry -i ${PIP_MIRROR} \
|
|
|
|
|
|
|
|
&& poetry config virtualenvs.create false \
|
|
|
|
|
|
|
|
&& poetry install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FROM python:3.11-slim-bullseye
|
|
|
|
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
|
|
|
ENV LANG=zh_CN.UTF-8 \
|
|
|
|
|
|
|
|
PATH=/opt/py3/bin:$PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ARG DEPENDENCIES=" \
|
|
|
|
|
|
|
|
libjpeg-dev \
|
|
|
|
|
|
|
|
libxmlsec1-openssl"
|
|
|
|
|
|
|
|
|
|
|
|
ARG TOOLS=" \
|
|
|
|
ARG TOOLS=" \
|
|
|
|
ca-certificates \
|
|
|
|
ca-certificates \
|
|
|
|
curl \
|
|
|
|
curl \
|
|
|
@ -47,40 +93,32 @@ ARG TOOLS=" \
|
|
|
|
wget"
|
|
|
|
wget"
|
|
|
|
|
|
|
|
|
|
|
|
ARG APT_MIRROR=http://mirrors.ustc.edu.cn
|
|
|
|
ARG APT_MIRROR=http://mirrors.ustc.edu.cn
|
|
|
|
|
|
|
|
|
|
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=core \
|
|
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=core \
|
|
|
|
|
|
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=core \
|
|
|
|
sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
|
|
|
|
sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
|
|
|
|
&& rm -f /etc/apt/apt.conf.d/docker-clean \
|
|
|
|
&& rm -f /etc/apt/apt.conf.d/docker-clean \
|
|
|
|
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
|
|
|
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get -y install --no-install-recommends ${BUILD_DEPENDENCIES} \
|
|
|
|
|
|
|
|
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
|
|
|
|
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
|
|
|
|
&& apt-get -y install --no-install-recommends ${TOOLS} \
|
|
|
|
&& apt-get -y install --no-install-recommends ${TOOLS} \
|
|
|
|
&& mkdir -p /root/.ssh/ \
|
|
|
|
&& mkdir -p /root/.ssh/ \
|
|
|
|
&& echo "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile /dev/null\n\tCiphers +aes128-cbc\n\tKexAlgorithms +diffie-hellman-group1-sha1\n\tHostKeyAlgorithms +ssh-rsa" > /root/.ssh/config \
|
|
|
|
&& echo "Host *\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile /dev/null\n\tCiphers +aes128-cbc\n\tKexAlgorithms +diffie-hellman-group1-sha1\n\tHostKeyAlgorithms +ssh-rsa" > /root/.ssh/config \
|
|
|
|
&& echo "set mouse-=a" > ~/.vimrc \
|
|
|
|
|
|
|
|
&& echo "no" | dpkg-reconfigure dash \
|
|
|
|
&& echo "no" | dpkg-reconfigure dash \
|
|
|
|
&& echo "zh_CN.UTF-8" | dpkg-reconfigure locales \
|
|
|
|
&& echo "zh_CN.UTF-8" | dpkg-reconfigure locales \
|
|
|
|
&& sed -i "s@# export @export @g" ~/.bashrc \
|
|
|
|
&& sed -i "s@# export @export @g" ~/.bashrc \
|
|
|
|
&& sed -i "s@# alias @alias @g" ~/.bashrc \
|
|
|
|
&& sed -i "s@# alias @alias @g" ~/.bashrc
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
COPY --from=stage-2 /opt/py3 /opt/py3
|
|
|
|
|
|
|
|
COPY --from=stage-1 /opt/jumpserver/release/jumpserver /opt/jumpserver
|
|
|
|
|
|
|
|
|
|
|
|
COPY --from=stage-build /opt/jumpserver/release/jumpserver /opt/jumpserver
|
|
|
|
|
|
|
|
WORKDIR /opt/jumpserver
|
|
|
|
WORKDIR /opt/jumpserver
|
|
|
|
|
|
|
|
|
|
|
|
ARG PIP_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple
|
|
|
|
ARG VERSION
|
|
|
|
RUN --mount=type=cache,target=/root/.cache \
|
|
|
|
ENV VERSION=$VERSION
|
|
|
|
set -ex \
|
|
|
|
|
|
|
|
&& echo > /opt/jumpserver/config.yml \
|
|
|
|
|
|
|
|
&& pip install poetry -i ${PIP_MIRROR} \
|
|
|
|
|
|
|
|
&& poetry config virtualenvs.create false \
|
|
|
|
|
|
|
|
&& poetry install --only=main
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VOLUME /opt/jumpserver/data
|
|
|
|
VOLUME /opt/jumpserver/data
|
|
|
|
VOLUME /opt/jumpserver/logs
|
|
|
|
VOLUME /opt/jumpserver/logs
|
|
|
|
|
|
|
|
|
|
|
|
ENV LANG=zh_CN.UTF-8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
EXPOSE 8080
|
|
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|