我正在创建一个 github docker 容器操作,该操作涉及许多依赖项 python、node、pypi 包和 npm 包。为了加快操作,我将大量依赖项安装从入口点移动到 Dockerfile。现在我的动作运行得非常快,但每次都需要很长时间来构建动作。
有没有办法可以预先构建操作,或者我是否需要将我的操作 docker 映像发布到某个存储库并从我的自定义映像中提供?
供参考,这是我的 Dockerfile。
FROM python:3
LABEL "com.github.actions.name"="kedro-action"
LABEL "com.github.actions.description"="A Github Action to run kedro commands"
LABEL "com.github.actions.icon"="it-branch"
LABEL "com.github.actions.color"="black"
LABEL "repository"="http://github.com/WaylonWalker/kedro-action"
LABEL "maintainer"="Waylon Walker <waylon@waylonwalker.com>"
RUN apt-get update
RUN apt-get install -y jq
ENV PYENV_ROOT /root/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
### INSTALL PYTHON ###
RUN pyenv install 3.7.6
RUN pyenv global 3.7.6
RUN python -m pip install --upgrade pip
RUN pip install kedro
RUN pip install kedro-viz
### INSTALL NODEJS ###
RUN apt-get install curl -y
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
RUN apt-get install nodejs -y
### CLONE KEDRO-STATIC-VIZ ###
RUN mkdir ~/build_dir && cd ~/build_dir
RUN git clone https://github.com/WaylonWalker/kedro-static-viz.git
RUN cd kedro-static-viz
RUN npm install -g gatsby-cli
RUN cd kedro-static-viz && npm install && npm audit fix
ADD entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]