diff --git a/.dockerignore b/.dockerignore index cbc1f8c97..0353b6cd4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,4 +6,5 @@ tmp/* django.db celerybeat.pid ### Vagrant ### -.vagrant/ \ No newline at end of file +.vagrant/ +apps/xpack/.git \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index cf70c1d19..f9cbb8e35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# 编译代码 FROM python:3.8.6-slim as stage-build MAINTAINER JumpServer Team ARG VERSION @@ -7,9 +8,12 @@ WORKDIR /opt/jumpserver ADD . . RUN cd utils && bash -ixeu build.sh +# 构建运行时环境 FROM python:3.8.6-slim ARG PIP_MIRROR=https://pypi.douban.com/simple ENV PIP_MIRROR=$PIP_MIRROR +ARG PIP_JMS_MIRROR=https://pypi.douban.com/simple +ENV PIP_JMS_MIRROR=$PIP_JMS_MIRROR WORKDIR /opt/jumpserver @@ -27,6 +31,7 @@ RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \ COPY ./requirements/requirements.txt ./requirements/requirements.txt RUN pip install --upgrade pip==20.2.4 setuptools==49.6.0 wheel==0.34.2 -i ${PIP_MIRROR} \ + && pip install --no-cache-dir $(grep -E 'jms|jumpserver' requirements/requirements.txt) -i ${PIP_JMS_MIRROR} \ && pip install --no-cache-dir -r requirements/requirements.txt -i ${PIP_MIRROR} \ && rm -rf ~/.cache/pip