jumpserver/Dockerfile

69 lines
2.1 KiB
Docker
Raw Normal View History

FROM jumpserver/core-base:20241210_070105 AS stage-build
2024-04-02 16:11:41 +00:00
2023-08-14 02:57:40 +00:00
ARG VERSION
WORKDIR /opt/jumpserver
2023-08-14 02:57:40 +00:00
ADD . .
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
FROM python:3.11-slim-bullseye
2024-04-02 16:11:41 +00:00
ENV LANG=en_US.UTF-8 \
PATH=/opt/py3/bin:$PATH
ARG DEPENDENCIES=" \
2024-11-21 12:30:03 +00:00
libldap2-dev \
libx11-dev"
2022-03-15 05:06:04 +00:00
ARG TOOLS=" \
2024-10-29 07:38:39 +00:00
cron \
2022-11-15 09:24:56 +00:00
ca-certificates \
2024-10-29 07:29:02 +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
ARG APT_MIRROR=http://deb.debian.org
2024-08-01 08:12:06 +00:00
RUN set -ex \
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 \
&& apt-get update > /dev/null \
&& 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 \
&& apt-get clean all \
&& rm -rf /var/lib/apt/lists/* \
&& echo "0 3 * * * root find /tmp -type f -mtime +1 -size +1M -exec rm -f {} \; && date > /tmp/clean.log" > /etc/cron.d/cleanup_tmp \
&& chmod 0644 /etc/cron.d/cleanup_tmp
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
ENTRYPOINT ["./entrypoint.sh"]
2018-11-13 07:57:44 +00:00
EXPOSE 8080
STOPSIGNAL SIGQUIT
CMD ["start", "all"]