我有一个Dockerfile,从安装texlive-full软件包开始,这是一个巨大的,需要很长时间.如果我docker build在本地,安装后创建的中间图像被缓存,后续构建很快.
但是,如果我推送到我自己的GitLab安装并启动GitLab-CI构建运行器,这似乎总是从头开始,重新下载FROM映像,再次执行apt-get安装.这对我来说似乎是一个巨大的浪费,所以我试图弄清楚如何让GitLab DinD图像在构建之间缓存中间图像,到目前为止没有运气.
我已经使用了尝试--cache-dir,并--docker-cache-dir为gitlab-runner register命令,都无济于事.
这甚至是gitlab-runner DinD图像应该能够做到的吗?
我的.gitlab-ci.yml:
build_job:
script:
- docker build --tag=example/foo .
Run Code Online (Sandbox Code Playgroud)
我的Dockerfile:
FROM php:5.6-fpm
MAINTAINER Roel Harbers <roel.harbers@example.com>
RUN apt-get update && apt-get install -qq -y --fix-missing --no-install-recommends texlive-full
RUN echo Do other stuff that has to be done every build.
Run Code Online (Sandbox Code Playgroud)
我使用GitLab CE 8.4.0和gitlab/gitlab-runner:latest作为跑步者
docker run -d --name gitlab-runner --restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /usr/local/gitlab-ci-runner/config:/etc/gitlab-runner \
gitlab/gitlab-runner:latest \
; …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Symfony Yaml dump函数输出一些嵌套的 php 数组数据。
use \Symfony\Component\Yaml\Yaml;
echo Yaml::dump([
'arr'=>[],
'foo'=>'bar',
]);
Run Code Online (Sandbox Code Playgroud)
但是,转储的 YAML 包含一个空对象:
arr: { }
foo: bar
Run Code Online (Sandbox Code Playgroud)
虽然我想要一个空列表:
arr: []
foo: bar
Run Code Online (Sandbox Code Playgroud)
我尝试使用该Yaml::DUMP_OBJECT_AS_MAP标志,使用ArrayObject代替数组文字,并使用EmptyIterator,但都无济于事。
我发现了两个与此相关的已关闭错误: https: //github.com/symfony/symfony/issues/9870和https://github.com/symfony/symfony/issues/15781,但那里的解决方案似乎没有工作,或者对我来说有点太老套和脆弱(YAML 输出上的 str_replace,brrrr)
我有一个简单的测试用例,其中包含迄今为止我尝试过的内容: https: //github.com/ComaVN/php-yaml-empty-array
对于如何解决这个问题,有任何的建议吗?