2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Drone.io の plugins/docker で BuildKit を使う

Last updated at Posted at 2019-04-09

Drone.io では plugins/docker という CI の中で docker build, docker push を行ってくれる便利なプラグインがある。

その plugins/docker で少し前に docker 18.09 が使えるようになっている。
https://github.com/drone-plugins/drone-docker/pull/227

PR のコメントにもあるとおり、plugins/docker:latest, plugins/docker:18.09.0, plugins/docker:18.09, plugins/docker:18 のタグ指定すると docker 18.09 が使えるようになり、
environment で DOCKER_BUILDKIT=1 を設定すると BuildKit を使った build ができるようになる。

.drone.yml(v0.8)
  build:
-   image: plugins/docker
+   image: plugins/docker:18.09
    repo: foo/bar
    tags: latest
+   target: production
+   environment:
+     - DOCKER_BUILDKIT=1
.drone.yml(v1.0)
kind: pipeline
name: default

steps:
 - name: build
-  image: plugins/docker
+  image: plugins/docker:18.09
+  environment:
+    DOCKER_BUILDKIT: 1
   settings:  
     repo: foo/bar
     tags: latest
+    target: production

すると、BuidKit が有効な状態で plugins/docker による build が行える :tada:

# 1 [internal] load build definition from Dockerfile
# 1       digest: sha256:174a08959d51507beac0d4f95d94024c127621ba7133f8eb737642389d05a66f
# 1         name: "[internal] load build definition from Dockerfile"
# 1      started: 2019-04-08 08:04:01.317228142 +0000 UTC
# 1 transferring dockerfile: 2.16kB 0.2s done
# 1    completed: 2019-04-08 08:04:01.72257637 +0000 UTC
# 1     duration: 405.348228ms
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?