2024-08-15 08:24:45 +00:00
|
|
|
FROM jumpserver/core-base:20240815_080231 AS stage-build
|
2024-04-02 16:11:41 +00:00
|
|
|
|
2023-08-14 02:57:40 +00:00
|
|
|
ARG VERSION
|
|
|
|
|
|
|
|
WORKDIR /opt/jumpserver
|
2024-07-23 08:38:00 +00:00
|
|
|
|
2023-08-14 02:57:40 +00:00
|
|
|
ADD . .
|
2024-07-23 08:38:00 +00:00
|
|
|
|
2023-10-16 05:30:51 +00:00
|
|
|
RUN echo > /opt/jumpserver/config.yml \
|
2024-05-13 10:21:51 +00:00
|
|
|
&& \
|
|
|
|
if [ -n "${VERSION}" ]; then \
|
|
|
|
sed -i "s@VERSION = .*@VERSION = '${VERSION}'@g" apps/jumpserver/const.py; \
|
|
|
|
fi
|
2023-08-14 02:57:40 +00:00
|
|
|
|
2024-05-13 10:21:51 +00:00
|
|
|
RUN set -ex \
|
|
|
|
&& export SECRET_KEY=$(head -c100 < /dev/urandom | base64 | tr -dc A-Za-z0-9 | head -c 48) \
|
|
|
|
&& . /opt/py3/bin/activate \
|
|
|
|
&& cd apps \
|
|
|
|
&& python manage.py compilemessages
|
|
|
|
|
2024-07-23 08:38:00 +00:00
|
|
|
|
2023-10-16 05:30:51 +00:00
|
|
|
FROM python:3.11-slim-bullseye
|
2024-04-02 16:11:41 +00:00
|
|
|
ENV LANG=en_US.UTF-8 \
|
2023-10-16 05:30:51 +00:00
|
|
|
PATH=/opt/py3/bin:$PATH
|
|
|
|
|
|
|
|
ARG DEPENDENCIES=" \
|
2024-04-02 16:11:41 +00:00
|
|
|
libldap2-dev \
|
2024-05-30 03:56:40 +00:00
|
|
|
libx11-dev"
|
2023-10-16 05:30:51 +00:00
|
|
|
|
2022-03-15 05:06:04 +00:00
|
|
|
ARG TOOLS=" \
|
2022-11-15 09:24:56 +00:00
|
|
|
ca-certificates \
|
2022-12-09 02:21:36 +00:00
|
|
|
default-libmysqlclient-dev \
|
|
|
|
openssh-client \
|
2024-07-01 03:16:25 +00:00
|
|
|
sshpass \
|
|
|
|
bubblewrap"
|
2022-11-15 09:24:56 +00:00
|
|
|
|
2024-07-23 08:38:00 +00:00
|
|
|
ARG APT_MIRROR=http://deb.debian.org
|
2024-08-01 08:12:06 +00:00
|
|
|
RUN set -ex \
|
2022-11-15 09:24:56 +00:00
|
|
|
&& rm -f /etc/apt/apt.conf.d/docker-clean \
|
2024-05-06 02:38:02 +00:00
|
|
|
&& sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
|
2022-11-15 09:24:56 +00:00
|
|
|
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
2024-07-23 08:38:00 +00:00
|
|
|
&& apt-get update > /dev/null \
|
2022-08-17 10:50:47 +00:00
|
|
|
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
|
|
|
|
&& apt-get -y install --no-install-recommends ${TOOLS} \
|
2024-07-23 08:38:00 +00:00
|
|
|
&& apt-get clean \
|
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-08-17 10:50:47 +00:00
|
|
|
&& echo "no" | dpkg-reconfigure dash \
|
2022-11-22 02:15:55 +00:00
|
|
|
&& sed -i "s@# export @export @g" ~/.bashrc \
|
2024-04-08 23:05:42 +00:00
|
|
|
&& sed -i "s@# alias @alias @g" ~/.bashrc
|
2024-04-08 09:54:34 +00:00
|
|
|
|
2024-07-23 08:38:00 +00:00
|
|
|
COPY --from=stage-build /opt /opt
|
|
|
|
COPY --from=stage-build /usr/local/bin /usr/local/bin
|
|
|
|
COPY --from=stage-build /opt/jumpserver/apps/libs/ansible/ansible.cfg /etc/ansible/
|
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
|
|
|
|
2018-11-13 07:57:44 +00:00
|
|
|
VOLUME /opt/jumpserver/data
|
|
|
|
|
2024-05-28 02:40:35 +00:00
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|
|
|
|
|
2018-11-13 07:57:44 +00:00
|
|
|
EXPOSE 8080
|
2022-11-27 12:20:26 +00:00
|
|
|
|
2024-05-28 02:40:35 +00:00
|
|
|
STOPSIGNAL SIGQUIT
|
|
|
|
|
|
|
|
CMD ["start", "all"]
|