Docker Github操作-创建快速运行的操作

Docker Github操作-创建快速运行的操作,docker,github-actions,github-package-registry,docker-repository,Docker,Github Actions,Github Package Registry,Docker Repository,我正在创建一个github docker容器操作,该操作涉及许多依赖项python、node、pypi包和npm包。为了加快操作速度,我将许多依赖项安装从入口点移动到Dockerfile。现在我的动作运行得非常快,但是每次构建动作都需要很长时间 是否有一种方法可以预先构建操作,或者我是否需要将我的操作docker映像发布到某个存储库中,并从我的自定义映像获取提要 作为参考,这是我的Dockerfile FROM python:3 LABEL "com.github.actions.name"=

我正在创建一个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"]
来自python:3的

标签“com.github.actions.name”=“kedro action”
标签“com.github.actions.description”=“运行kedro命令的github操作”
标签“com.github.actions.icon”=“it分支”
标签“com.github.actions.color”=“黑色”
标签“存储库”=“http://github.com/WaylonWalker/kedro-action"
标签“维护者”=“韦伦沃克”
运行apt获取更新
运行apt-get-install-y jq
ENV PYENV_ROOT/ROOT/.PYENV
环境路径$PYENV_根/垫片:$PYENV_根/bin:$PATH
运行curl-Lhttps://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer |猛击
###安装PYTHON###
运行pyenv安装3.7.6
运行pyenv global 3.7.6
运行python-mpip安装--升级pip
运行pip安装kedro
运行pip安装kedro viz
###安装NODEJS###
运行apt-get安装curl-y
运行curl-sLhttps://deb.nodesource.com/setup_11.x |猛击-
运行apt get install nodejs-y
###克隆KEDRO-STATIC-VIZ###
运行mkdir~/build\u dir&&cd~/build\u dir
运行git克隆https://github.com/WaylonWalker/kedro-static-viz.git
运行cd kedro静态viz
运行npm安装-g gatsby cli
运行cd kedro静态viz和npm安装和npm审核修复程序
添加entrypoint.sh/entrypoint.sh
入口点[“/ENTRYPOINT.sh”]

您可以为您的操作预构建Docker映像,然后在
action.yml
文件中指定预构建映像,而不是
Dockerfile
。请参阅文档

这是我的一个行动的一个例子


绝对请这样做!github让我很恼火,为什么人们不应该为自己的行为发布图片而不是dockerfiles。一件小事。您应该时不时地重建映像,以下载最新的操作系统软件包,这些软件包将修复安全漏洞。
runs:
  using: 'docker'
  image: 'docker://peterevans/dockerhub-description:2.1.0'