ci: try faster build
This commit is contained in:
parent
137ecfbebb
commit
545221fa52
1 changed files with 17 additions and 21 deletions
38
.github/workflows/build-and-publish.yml
vendored
38
.github/workflows/build-and-publish.yml
vendored
|
@ -8,6 +8,9 @@ name: "Build, Test and Publish"
|
||||||
# run it during pull request
|
# run it during pull request
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: glenux/teaching-boilerplate
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-docker-image:
|
build-docker-image:
|
||||||
name: "Build docker image"
|
name: "Build docker image"
|
||||||
|
@ -24,21 +27,14 @@ jobs:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Build image and save as file
|
- name: Build image and save as file
|
||||||
uses: docker/build-push-action@v2
|
run: |
|
||||||
with:
|
docker build \
|
||||||
# relative path to the place where source code with Dockerfile
|
--cache-from $IMAGE_NAME:latest \
|
||||||
# is located
|
--tag $IMAGE_NAME:latest \
|
||||||
context: .
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
||||||
file: docker/Dockerfile
|
"."
|
||||||
# Note: tags has to be all lower-case
|
docker save $IMAGE_NAME:latest > /tmp/image.tar
|
||||||
tags: |
|
|
||||||
glenux/teaching-boilerplate:latest
|
|
||||||
outputs: type=docker,dest=/tmp/teaching-boilerplate.image.tar
|
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
@ -48,12 +44,12 @@ jobs:
|
||||||
echo "BUILD_VERSION=$BUILD_VERSION" >> /tmp/extra.env
|
echo "BUILD_VERSION=$BUILD_VERSION" >> /tmp/extra.env
|
||||||
cat /tmp/extra.env
|
cat /tmp/extra.env
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: teaching-boilerplate-image
|
name: artifacts
|
||||||
path: |
|
path: |
|
||||||
/tmp/teaching-boilerplate.image.tar
|
/tmp/image.tar
|
||||||
/tmp/extra.env
|
/tmp/extra.env
|
||||||
|
|
||||||
test-docker-image:
|
test-docker-image:
|
||||||
|
@ -68,7 +64,7 @@ jobs:
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: teaching-boilerplate-image
|
name: artifacts
|
||||||
path: /tmp
|
path: /tmp
|
||||||
|
|
||||||
- name: Load environment
|
- name: Load environment
|
||||||
|
@ -77,7 +73,7 @@ jobs:
|
||||||
|
|
||||||
- name: Load image
|
- name: Load image
|
||||||
run: |
|
run: |
|
||||||
docker load --input /tmp/teaching-boilerplate.image.tar
|
docker load --input /tmp/image.tar
|
||||||
docker image ls -a
|
docker image ls -a
|
||||||
|
|
||||||
- name: Build HTML for docs
|
- name: Build HTML for docs
|
||||||
|
@ -101,7 +97,7 @@ jobs:
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: teaching-boilerplate-image
|
name: artifacts
|
||||||
path: /tmp
|
path: /tmp
|
||||||
|
|
||||||
- name: Load environment
|
- name: Load environment
|
||||||
|
@ -114,7 +110,7 @@ jobs:
|
||||||
|
|
||||||
- name: Load image
|
- name: Load image
|
||||||
run: |
|
run: |
|
||||||
docker load --input /tmp/myimage.tar
|
docker load --input /tmp/image.tar
|
||||||
docker image ls -a
|
docker image ls -a
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
|
|
Loading…
Reference in a new issue