Docker Image Build Workflow #71
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image Build Workflow | |
on: | |
push: | |
branches: | |
- "master" | |
pull_request: | |
branches: | |
- "master" | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
build_docker_image: | |
name: Build ${{ matrix.image }} | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
strategy: | |
matrix: | |
image: | |
- ros_kinetic | |
- ros_kinetic_cuda9.2_chainer | |
- ros_melodic | |
- ros_melodic_realsense | |
- ros_melodic_cuda10.0 | |
- ros_melodic_cuda9.2_chainer | |
- ros_noetic | |
- ros_noetic_realsense | |
- ros_noetic_cuda11.3_tensorrt7.2 | |
- ros_noetic_cuda11.3_torch1.11 | |
steps: | |
# Make free space | |
# https://stackoverflow.com/questions/75536771/github-runner-out-of-disk-space-after-building-docker-image | |
- 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: df . -h | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Build Image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./${{ matrix.image }} | |
push: false | |
tags: sktometometo/${{ matrix.image }} |