Em *_*dhu 7 bitbucket bitbucket-pipelines
我正在使用来自 dockerhub 的外部 docker 图像。
在每一步中,dockerimage 都会一次又一次地从 dockerhub 中拉取。是的,这是理想的工作流程。
我的问题是我们可以缓存这个图像,这样它就不会在每一步都从 dockerhub 拉取吗?这个 DockerImage 不会经常更改,因为它只预装了节点和流星。
那么可以缓存docker镜像吗?
原来的 bitbucket-pipeline.yml
image: tasktrain/node-meteor-mup
pipelines:
branches:
'{develop}':
- step:
name: "Client: Install Dependencies"
caches:
- node
script:
- npm install
- npm run setup-meteor-client-bundle
artifacts:
- node_modules/**
- step:
name: "Client: Build for Staging"
script:
- npm run build-browser:stag
artifacts:
- dist/**
- step:
name: "Client: Deploy to Staging"
deployment: staging
script:
- pipe: atlassian/aws-s3-deploy:0.2.2
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
S3_BUCKET: $S3_STAGING_BUCKET_NAME
LOCAL_PATH: 'dist'
ACL: "public-read"
DELETE_FLAG: "true"
EXTRA_ARGS: "--follow-symlinks --quiet"
- step:
name: "Server: Build and Deploy to Staging"
script:
- cd server
- mup setup --config=.deploy/mup-settings.stag.js
- mup deploy --config=.deploy/mup-settings.stag.js --settings=meteor-settings.stag.json
Run Code Online (Sandbox Code Playgroud)
Dar*_*idl 12
正如 OP 在对另一个答案的评论中所说,定义 Docker 缓存对构建映像本身不起作用
\nimage: tasktrain/node-meteor-mup\nRun Code Online (Sandbox Code Playgroud)\n始终为每个步骤下载该文件,然后在该映像中执行步骤脚本。嗯,Docker 缓存
\n services:\n - docker\n caches:\n - docker\nRun Code Online (Sandbox Code Playgroud)\n仅适用于拉取或内置的图像 a step.
\n然而,根据这篇博客文章,Bitbucket Pipelines 最近开始在内部缓存公共构建镜像:
\n\n\n公共镜像缓存 \xe2\x80\x93 在幕后,Pipelines 最近开始缓存公共 Docker 镜像,从而显着缩短了在我们的基础设施上运行的所有构建的启动时间。
\n
还有一个开放功能请求也可以缓存私有构建映像。
\n确实可以缓存依赖项,并且 docker 是Bitbucket Pipelines 的预定义缓存之一
pipelines:
default:
- step:
services:
- docker
caches:
- docker
script:
- docker pull my-own-repository:5000/my-image
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6228 次 |
| 最近记录: |