Skip to content

Commit a6601f1

Browse files
committed
build: freeing disk space Docker image building
1 parent 15431a1 commit a6601f1

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/buildDockerImage.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12+
# Free disk space
13+
- name: Free up disk space
14+
run: sudo rm -rf /usr/share/dotnet
15+
16+
# checkout repository
1217
- name: Checkout repository
13-
uses: actions/checkout@v2.3.4
18+
uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 1
1421

1522
# Build Docker image
1623
- id: get-timestamp
@@ -36,7 +43,12 @@ jobs:
3643
image_tag: ${{github.sha}}
3744
push_image_and_stages: true
3845
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
39-
password: "${{ secrets.DOCKER_REGISTRY_TOKEN }}"
46+
password: "${{ secrets.DOCKER_REGISTRY_TOKEN }}"
47+
48+
- name: Clean up unnecessary images to free disk space
49+
run: |
50+
images=$(docker images | grep -v ${{github.sha}} | grep ago | awk '{print $3}')
51+
docker rm -f $images
4052
4153
- name: Label base Docker image
4254
run: |
@@ -57,8 +69,15 @@ jobs:
5769
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
5870
password: "${{ secrets.DOCKER_REGISTRY_TOKEN }}"
5971

72+
- name: Clean up unnecessary images to free disk space
73+
run: |
74+
images=$(docker images | grep -v ${{github.sha}} | grep ago | awk '{print $3}')
75+
docker rm -f $images
76+
6077
- name: Label Docker image
6178
run: |
79+
docker image tag ghcr.io/biosimulators/biosimulators-base-stages:${{github.sha}} ghcr.io/biosimulators/biosimulators-base:${{github.sha}}
80+
docker image tag ghcr.io/biosimulators/biosimulators-base-stages:${{github.sha}} ghcr.io/biosimulators/biosimulators-base:latest
6281
docker image tag ghcr.io/biosimulators/biosimulators-stages:${{github.sha}} ghcr.io/biosimulators/biosimulators:${{github.sha}}
6382
docker image tag ghcr.io/biosimulators/biosimulators-stages:${{github.sha}} ghcr.io/biosimulators/biosimulators:latest
6483

0 commit comments

Comments
 (0)