Skip to content

Commit

Permalink
Update docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
marc1uk authored Feb 7, 2024
1 parent 08bec19 commit c8c4c63
Showing 1 changed file with 62 additions and 28 deletions.
90 changes: 62 additions & 28 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,67 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: cleanup
run:
# Workaround to provide additional free space for testing.
# https://github.com/actions/virtual-environments/issues/2840
rm -rf /usr/share/dotnet;
rm -rf /opt/ghc;
rm -rf /usr/local/lib/android
rm -rf "/usr/local/share/boost";
rm -rf "$AGENT_TOOLSDIRECTORY";
docker rmi $(docker image ls -aq) || true;
swapoff /swapfile || true;
rm -rf /swapfile;
apt-get autoremove -y >/dev/null 2>&1 || true;
apt-get autoclean -y >/dev/null 2>&1 || true;

- name: Build the Docker image
uses: actions/checkout@v2
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 }}
- 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 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 /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 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"
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: push docker images
run: docker push anniesoft/toolanalysis:latest

- name: cleanup2
run:
docker rmi $(docker image ls -aq) || true;
- name: cleanup2
run:
docker rmi $(docker image ls -aq) || true;

0 comments on commit c8c4c63

Please sign in to comment.