Skip to content

Pre-clean disk space #102

Pre-clean disk space

Pre-clean disk space #102

name: build-push-containers
on:
release:
types: [published]
push:
branches:
- 'main'
- 'og-develop'
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Check disk space
run: df . -h
-
name: Free disk space
run: |
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm || true
echo "some directories deleted"
sudo apt install aptitude -y >/dev/null 2>&1
sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \
esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \
google-cloud-sdk imagemagick \
libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \
mercurial apt-transport-https mono-complete libmysqlclient \
unixodbc-dev yarn chrpath libssl-dev libxft-dev \
libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \
snmp pollinate libpq-dev postgresql-client powershell ruby-full \
sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \
-y -f >/dev/null 2>&1
sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1
sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
echo "some packages purged"
-
name: Check disk space
run: |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head
df . -h
sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head
-
name: Checkout
uses: actions/checkout@v4
-
name: Login to NVCR
uses: redhat-actions/podman-login@v1
with:
registry: nvcr.io
username: ${{ secrets.NVCR_USERNAME }}
password: ${{ secrets.NVCR_PASSWORD }}
-
name: Login to Docker Hub
uses: redhat-actions/podman-login@v1
with:
registry: docker.io
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
-
name: Metadata for dev Image
id: meta-dev
uses: docker/metadata-action@v5
with:
images: |
stanfordvl/omnigibson-dev
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
-
name: Metadata for prod Image
id: meta-prod
uses: docker/metadata-action@v5
with:
images: |
stanfordvl/omnigibson
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
-
name: Build dev image
id: build-dev
uses: redhat-actions/buildah-build@v2
with:
image: stanfordvl/omnigibson-dev
tags: ${{ steps.meta-dev.outputs.tags }}
labels: ${{ steps.meta-dev.outputs.labels }}
containerfiles: docker/dev.Dockerfile
-
name: Build prod image
id: build-prod
uses: docker/build-push-action@v5
with:
image: stanfordvl/omnigibson
tags: ${{ steps.meta-prod.outputs.tags }}
labels: ${{ steps.meta-prod.outputs.labels }}
containerfiles: docker/prod.Dockerfile
-
name: Push dev image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-dev.outputs.image }}
tags: ${{ steps.build-dev.outputs.tags }}
registry: docker.io
-
name: Push prod image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-prod.outputs.image }}
tags: ${{ steps.build-prod.outputs.tags }}
registry: docker.io