jumpserver/Dockerfile

67 lines
2.0 KiB
Docker
Raw Normal View History

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
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-04-02 16:11:41 +00:00
libldap2-dev \
libx11-dev"
2022-03-15 05:06:04 +00:00
ARG TOOLS=" \
2022-11-15 09:24:56 +00:00
ca-certificates \
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 \
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 \
&& apt-get update > /dev/null \
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
&& apt-get -y install --no-install-recommends ${TOOLS} \
&& 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 \
&& 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
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"]