Browse Source

perf: 多步骤构建

pull/8923/head
吴小白 2 years ago committed by Jiangjie.Bai
parent
commit
7ac00d5fdf
  1. 22
      Dockerfile
  2. 22
      Dockerfile.loong64

22
Dockerfile

@ -1,3 +1,13 @@
FROM python:3.8-slim as stage-build
ARG TARGETARCH
ARG VERSION
ENV VERSION=$VERSION
WORKDIR /opt/jumpserver
ADD . .
RUN cd utils && bash -ixeu build.sh
FROM python:3.8-slim FROM python:3.8-slim
ARG TARGETARCH ARG TARGETARCH
MAINTAINER JumpServer Team <ibuler@qq.com> MAINTAINER JumpServer Team <ibuler@qq.com>
@ -79,15 +89,9 @@ RUN --mount=type=cache,target=/root/.cache/pip \
&& pip install $(grep -E 'jms|jumpserver' requirements/requirements.txt) -i ${PIP_JMS_MIRROR} \ && pip install $(grep -E 'jms|jumpserver' requirements/requirements.txt) -i ${PIP_JMS_MIRROR} \
&& pip install -r requirements/requirements.txt && pip install -r requirements/requirements.txt
ARG VERSION COPY --from=stage-build /opt/jumpserver/release/jumpserver /opt/jumpserver
ENV VERSION=$VERSION RUN echo > /opt/jumpserver/config.yml \
&& rm -rf /tmp/build
ADD . .
RUN cd utils \
&& bash -ixeu build.sh \
&& mv ../release/jumpserver /opt/jumpserver \
&& rm -rf /tmp/build \
&& echo > /opt/jumpserver/config.yml
WORKDIR /opt/jumpserver WORKDIR /opt/jumpserver
VOLUME /opt/jumpserver/data VOLUME /opt/jumpserver/data

22
Dockerfile.loong64

@ -1,3 +1,13 @@
FROM python:3.8-slim as stage-build
ARG TARGETARCH
ARG VERSION
ENV VERSION=$VERSION
WORKDIR /opt/jumpserver
ADD . .
RUN cd utils && bash -ixeu build.sh
FROM python:3.8-slim FROM python:3.8-slim
ARG TARGETARCH ARG TARGETARCH
MAINTAINER JumpServer Team <ibuler@qq.com> MAINTAINER JumpServer Team <ibuler@qq.com>
@ -69,15 +79,9 @@ RUN --mount=type=cache,target=/root/.cache/pip \
&& pip install $(grep -E 'jms|jumpserver' requirements/requirements.txt) -i ${PIP_JMS_MIRROR} \ && pip install $(grep -E 'jms|jumpserver' requirements/requirements.txt) -i ${PIP_JMS_MIRROR} \
&& pip install -r requirements/requirements.txt && pip install -r requirements/requirements.txt
ARG VERSION COPY --from=stage-build /opt/jumpserver/release/jumpserver /opt/jumpserver
ENV VERSION=$VERSION RUN echo > /opt/jumpserver/config.yml \
&& rm -rf /tmp/build
ADD . .
RUN cd utils \
&& bash -ixeu build.sh \
&& mv ../release/jumpserver /opt/jumpserver \
&& rm -rf /tmp/build \
&& echo > /opt/jumpserver/config.yml
WORKDIR /opt/jumpserver WORKDIR /opt/jumpserver
VOLUME /opt/jumpserver/data VOLUME /opt/jumpserver/data

Loading…
Cancel
Save