-
Notifications
You must be signed in to change notification settings - Fork 21
68 lines (68 loc) · 3 KB
/
dockerimage.yml
File metadata and controls
68 lines (68 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Increase number to trigger CI -> 1
name: The showdown
on:
push: {}
jobs:
build_no_cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: docker build . -t thing
build_no_cache_buildkit:
env:
DOCKER_BUILDKIT: '1'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: docker build . -t thing
build_with_docker_save_load:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: cache-docker
uses: actions/cache@v1
with:
path: /tmp/docker-save
key: docker-save-${{ hashFiles('Dockerfile') }}
- run: docker load -i /tmp/docker-save/snapshot.tar || true
if: steps.cache-docker.outputs.cache-hit == 'true'
- run: docker build . -t thing --cache-from=thing-cache
- run: docker tag thing thing-cache && mkdir -p /tmp/docker-save && docker save thing-cache -o /tmp/docker-save/snapshot.tar && ls -lh /tmp/docker-save || true
if: always() && steps.cache-docker.outputs.cache-hit != 'true'
build_with_local_registry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: cache-docker
uses: actions/cache@v1
with:
path: /tmp/docker-registry
key: docker-registry-no-buildkit-${{ hashFiles('Dockerfile') }}
- run: docker run -d -p 5000:5000 --restart=always --name registry -v /tmp/docker-registry:/var/lib/registry registry:2 && npx wait-on tcp:5000
- run: docker pull localhost:5000/thing || true
- run: docker build . -t thing --cache-from=localhost:5000/thing
- run: docker tag thing localhost:5000/thing && docker push localhost:5000/thing || true
if: steps.cache.outputs.cache-hit != 'true'
build_with_local_registry_buildkit:
env:
DOCKER_BUILDKIT: '1'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: cache-docker
uses: actions/cache@v1
with:
path: /tmp/docker-registry
key: docker-registry-buildkit-${{ hashFiles('Dockerfile') }}
- run: docker run -d -p 5000:5000 --restart=always --name registry -v /tmp/docker-registry:/var/lib/registry registry:2 && npx wait-on tcp:5000
- run: docker build . -t thing --cache-from=localhost:5000/thing --build-arg BUILDKIT_INLINE_CACHE=1
- run: docker tag thing localhost:5000/thing && docker push localhost:5000/thing || true
if: steps.cache.outputs.cache-hit != 'true'
build_with_gpr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
- run: docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/build-cache-no-buildkit || true
- run: docker build . -t thing --cache-from=docker.pkg.github.com/$GITHUB_REPOSITORY/build-cache-no-buildkit
- run: docker tag thing docker.pkg.github.com/$GITHUB_REPOSITORY/build-cache-no-buildkit && docker push docker.pkg.github.com/$GITHUB_REPOSITORY/build-cache-no-buildkit || true