| 1 |
name: e2e-image |
| 2 |
|
| 3 |
# Don't want to build and push this image for PRs; only pushes to master |
| 4 |
|
| 5 |
on: |
| 6 |
push: |
| 7 |
branches: [master] |
| 8 |
paths: |
| 9 |
- e2e/Dockerfile |
| 10 |
- e2e/basic.ini |
| 11 |
|
| 12 |
# Build our image caching the layers |
| 13 |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#github-cache |
| 14 |
|
| 15 |
jobs: |
| 16 |
build: |
| 17 |
runs-on: ubuntu-latest |
| 18 |
steps: |
| 19 |
- uses: actions/checkout@v2 |
| 20 |
- uses: docker/setup-buildx-action@v1 |
| 21 |
- name: Cache Docker layers |
| 22 |
uses: actions/cache@v2 |
| 23 |
with: |
| 24 |
path: /tmp/.buildx-cache |
| 25 |
key: ${{ runner.os }}-buildx-${{ hashFiles('e2e/Dockerfile') }} |
| 26 |
restore-keys: | |
| 27 |
${{ runner.os }}-buildx- |
| 28 |
${{ runner.os }}- |
| 29 |
- uses: docker/login-action@v1 |
| 30 |
with: |
| 31 |
registry: ghcr.io |
| 32 |
username: ${{ github.repository_owner }} |
| 33 |
password: ${{ secrets.GITHUB_TOKEN }} |
| 34 |
- uses: docker/build-push-action@v2 |
| 35 |
with: |
| 36 |
context: e2e/ |
| 37 |
push: true |
| 38 |
tags: ghcr.io/${{ github.repository }}/e2e:latest |
| 39 |
cache-from: type=local,src=/tmp/.buildx-cache |
| 40 |
cache-to: type=local,dest=/tmp/.buildx-cache-new |
| 41 |
# Temp fix |
| 42 |
# https://github.com/docker/build-push-action/issues/252 |
| 43 |
# https://github.com/moby/buildkit/issues/1896 |
| 44 |
- name: Move cache |
| 45 |
run: | |
| 46 |
rm -rf /tmp/.buildx-cache |
| 47 |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |