Create MonitoringSetup.sh #55
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 CI | |
on: | |
push: | |
branches: [ Application ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Check disk space | |
run: | | |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head | |
df . -h | |
sudo du / -hx -d 4 --threshold=1G | sort -hr | head | |
- name: Free disk space | |
run: | | |
# https://github.com/actions/virtual-environments/issues/2840 | |
# https://stackoverflow.com/questions/75536771/github-runner-out-of-disk-space-after-building-docker-image | |
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 /usr/local/share/boost || true | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY"; | |
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 google-cloud-cli 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 google-chrome-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 aptitude purge '~n ^temurin' -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" | |
docker rmi $(docker image ls -aq) || true | |
sudo swapoff /swapfile || true | |
sudo rm -rf /swapfile | |
sudo apt-get autoremove -y >/dev/null 2>&1 || true | |
sudo apt-get autoclean -y >/dev/null 2>&1 || true | |
- name: Check disk space | |
run: | | |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head | |
df . -h | |
sudo du / -hx -d 4 --threshold=1G | sort -hr | head | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag anniesoft/toolanalysis:latest | |
- name: docker login | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: push docker images | |
run: docker push anniesoft/toolanalysis:latest | |
- name: cleanup2 | |
run: | |
docker rmi $(docker image ls -aq) || true; |