jumpserver/Dockerfile

87 lines
2.9 KiB
Docker
Raw Normal View History

2023-08-14 02:57:40 +00:00
FROM python:3.11-slim-bullseye as stage-build
ARG TARGETARCH
ARG VERSION
ENV VERSION=$VERSION
WORKDIR /opt/jumpserver
ADD . .
RUN cd utils && bash -ixeu build.sh
FROM python:3.11-slim-bullseye
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=" \
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
2022-11-15 09:24:56 +00:00
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=core \
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 \
2023-08-14 02:57:40 +00:00
&& 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} \
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 \
2022-03-15 05:06:04 +00:00
&& echo "set mouse-=a" > ~/.vimrc \
&& 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 \
&& rm -rf /var/lib/apt/lists/*
2018-11-13 07:57:44 +00:00
2023-08-03 06:33:22 +00:00
COPY --from=stage-build /opt/jumpserver/release/jumpserver /opt/jumpserver
WORKDIR /opt/jumpserver
2022-03-15 05:06:04 +00:00
2023-08-14 02:57:40 +00:00
ARG PIP_MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple
2023-08-03 06:33:22 +00:00
RUN --mount=type=cache,target=/root/.cache \
2022-11-15 09:24:56 +00:00
set -ex \
2023-08-03 06:33:22 +00:00
&& echo > /opt/jumpserver/config.yml \
&& pip install poetry -i ${PIP_MIRROR} \
2023-08-02 07:37:30 +00:00
&& poetry config virtualenvs.create false \
2023-08-02 07:45:13 +00:00
&& poetry install --only=main
2022-04-22 05:44:39 +00:00
2018-11-13 07:57:44 +00:00
VOLUME /opt/jumpserver/data
VOLUME /opt/jumpserver/logs
ENV LANG=zh_CN.UTF-8
EXPOSE 8080
2018-11-13 07:57:44 +00:00
ENTRYPOINT ["./entrypoint.sh"]