-
Notifications
You must be signed in to change notification settings - Fork 23
51 lines (44 loc) · 1.16 KB
/
docker.yml
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
name: Docker
on:
push:
branches:
- master
paths-ignore:
- '**/*.md'
- '**/*.ipynb'
- '.gitignore'
pull_request:
branches:
- master
paths-ignore:
- '**/*.md'
- '**/*.ipynb'
- '.gitignore'
jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/docker-layers
key: docker-layers-${{ runner.os }}-${{ github.sha }}
restore-keys: docker-layers-${{ runner.os }}-
- name: Load cached Docker layers
run: |
if [ -d "/tmp/docker-layers" ]; then
docker load < /tmp/docker-layers/cache.tar
fi
- name: Build Docker image
run: |
docker -D build \
--cache-from=yuzhouwan:1.1.2-SNAPSHOT \
-t yuzhouwan:1.1.2-SNAPSHOT \
-f distribution/docker/Dockerfile .
- name: Save Docker layers
run: |
mkdir -p /tmp/docker-layers
docker save yuzhouwan:1.1.2-SNAPSHOT > /tmp/docker-layers/cache.tar