Skip to content

Commit

Permalink
PR #123: CI: Streamline docker build @master-bob
Browse files Browse the repository at this point in the history
Change to build the image using docker action. Subsequently reducing build time
~50%, as the image will only need to be built once. Currently image is
built twice.

The default driver uses double the disk space, see
docker/build-push-action#321 (in brief, the image is built in the
build-push-action local cache, tared, and then transfered to the local docker).
This is a problem as this image is so large. Using the docker driver
will workaround this.
  • Loading branch information
mingchen committed Apr 1, 2023
2 parents d1608d5 + ab46842 commit fce13e8
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c
with:
driver: docker

- name: Pre build
run: |
Expand Down Expand Up @@ -87,16 +89,19 @@ jobs:
#docker rmi $(docker images | grep -v IMAGE | awk '{print $3}')
docker images
# Remove unneeded and installed software to free up space
sudo rm -rf /usr/local/lib/android/sdk
sudo rm -rf /opt/hostedtoolcache
# check disk space one more time
df -h
- name: Build local docker image for test
# if: github.event_name != 'pull_request'
run: |
TAG=$GITHUB_SHA
docker build . \
--file Dockerfile \
--tag ${{ env.IMAGE_NAME}}:${{ env.TAG}}
- name: Build and load local docker image for test
uses: docker/build-push-action@v4
with:
context: .
load: true
tags: ${{ env.IMAGE_NAME}}:${{ env.TAG}}

- name: Inspect local docker image
run: |
Expand Down

0 comments on commit fce13e8

Please sign in to comment.