jumpserver/Dockerfile-ce

125 lines
4.3 KiB
Plaintext
Raw Normal View History

FROM python:3.11-slim-bullseye as stage-1
2023-08-14 02:57:40 +00:00
ARG TARGETARCH
ARG VERSION
ENV VERSION=$VERSION
WORKDIR /opt/jumpserver
ADD . .
RUN echo > /opt/jumpserver/config.yml \
&& cd utils && bash -ixeu build.sh
2023-08-14 02:57:40 +00:00
FROM python:3.11-slim-bullseye as stage-2
2022-11-15 09:24:56 +00:00
ARG TARGETARCH
2022-03-15 05:06:04 +00:00
ARG BUILD_DEPENDENCIES=" \
2022-11-15 09:24:56 +00:00
g++ \
make \
pkg-config"
2022-03-15 05:06:04 +00:00
ARG DEPENDENCIES=" \
2022-11-15 09:24:56 +00:00
freetds-dev \
libpq-dev \
libffi-dev \
libjpeg-dev \
2023-08-03 06:33:22 +00:00
libkrb5-dev \
2022-11-15 09:24:56 +00:00
libldap2-dev \
libsasl2-dev \
2023-07-03 02:28:25 +00:00
libssl-dev \
2022-11-15 09:24:56 +00:00
libxml2-dev \
libxmlsec1-dev \
libxmlsec1-openssl \
2023-06-08 14:03:45 +00:00
freerdp2-dev \
libaio-dev"
2022-03-15 05:06:04 +00:00
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
2023-11-17 01:49:05 +00:00
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=core-apt \
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=core-apt \
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 \
&& pip install poetry -i ${PIP_MIRROR} \
&& poetry config virtualenvs.create false \
2023-11-17 01:49:05 +00:00
&& . /opt/py3/bin/activate \
&& 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 \
2023-11-17 01:49:05 +00:00
libx11-dev \
libxmlsec1-openssl"
2022-03-15 05:06:04 +00:00
ARG TOOLS=" \
2022-11-15 09:24:56 +00:00
ca-certificates \
2022-12-09 03:06:58 +00:00
curl \
default-libmysqlclient-dev \
2022-12-21 03:21:48 +00:00
default-mysql-client \
2023-09-22 08:16:22 +00:00
iputils-ping \
2022-11-15 09:24:56 +00:00
locales \
2023-08-14 06:25:08 +00:00
nmap \
openssh-client \
2023-09-21 09:43:37 +00:00
patch \
sshpass \
2022-11-15 09:24:56 +00:00
telnet \
2022-12-21 03:56:39 +00:00
vim \
2022-11-15 09:24:56 +00:00
wget"
2022-11-16 00:58:16 +00:00
ARG APT_MIRROR=http://mirrors.ustc.edu.cn
2023-11-17 01:49:05 +00:00
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=core-apt \
--mount=type=cache,target=/var/lib/apt,sharing=locked,id=core-apt \
2022-11-16 00:58:16 +00:00
sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
2022-11-15 09:24:56 +00:00
&& 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 ${DEPENDENCIES} \
&& apt-get -y install --no-install-recommends ${TOOLS} \
2022-03-15 05:06:04 +00:00
&& mkdir -p /root/.ssh/ \
2023-03-28 03:11:15 +00:00
&& 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 "no" | dpkg-reconfigure dash \
2022-11-15 09:24:56 +00:00
&& echo "zh_CN.UTF-8" | dpkg-reconfigure locales \
2022-11-22 02:15:55 +00:00
&& sed -i "s@# export @export @g" ~/.bashrc \
&& sed -i "s@# alias @alias @g" ~/.bashrc
COPY --from=stage-2 /opt/py3 /opt/py3
COPY --from=stage-1 /opt/jumpserver/release/jumpserver /opt/jumpserver
2018-11-13 07:57:44 +00:00
2023-08-03 06:33:22 +00:00
WORKDIR /opt/jumpserver
2022-03-15 05:06:04 +00:00
ARG VERSION
ENV VERSION=$VERSION
2022-04-22 05:44:39 +00:00
2018-11-13 07:57:44 +00:00
VOLUME /opt/jumpserver/data
EXPOSE 8080
2018-11-13 07:57:44 +00:00
ENTRYPOINT ["./entrypoint.sh"]