docker build #698
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 build | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 0 * * * | |
pull_request: | |
push: | |
branches: | |
- master | |
release: | |
types: [published] | |
jobs: | |
build: | |
name: Build Docker Image | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 180 | |
steps: | |
- name: Clean space | |
run: | | |
docker images | |
sudo rm -rf "/opt/*" || true | |
sudo rm -rf "/usr/share/dotnet" || true | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" || true | |
sudo rm -rf "/usr/local/lib/android" || true | |
sudo rm -rf "/usr/local/share/boost" || true | |
sudo rm -rf "/usr/lib/jvm" || true | |
sudo rm -rf "/usr/share/swift" || true | |
sudo rm -rf "/usr/local/julia*" || true | |
sudo rm -rf "/usr/share/kotlinc" || true | |
sudo rm -rf "/usr/local/share/edge_driver" || true | |
sudo rm -rf "/usr/local/share/chromedriver-linux64" || true | |
sudo rm -rf "/usr/local/share/gecko_driver" || true | |
sudo rm -rf "/usr/share/miniconda" || true | |
sudo rm -rf "/usr/local/share/phantomjs*" || true | |
sudo rm -rf "/usr/share/sbt" || true | |
sudo rm -rf "/usr/local/sqlpackage" || true | |
docker rmi $(docker image ls -q --filter "reference=node*") | |
docker rmi $(docker image ls -q --filter "reference=buildpack*") | |
docker rmi $(docker image ls -q --filter "reference=debian*") | |
docker rmi $(docker image ls -q --filter "reference=alpine*") | |
docker rmi $(docker image ls -q --filter "reference=ubuntu:18.04") | |
sudo npm uninstall bazel | |
rustup self uninstall -y | |
sudo apt purge \ | |
ansible \ | |
apache2 \ | |
aria2 \ | |
azure-cli \ | |
cabal* \ | |
clang* \ | |
dotnet-sdk* \ | |
firefox \ | |
ghc* \ | |
google-chrome-stable \ | |
google-cloud-sdk \ | |
kubectl \ | |
libpq-dev \ | |
microsoft-edge-stable \ | |
moby-buildx \ | |
moby-cli \ | |
moby-compose \ | |
moby-engine \ | |
mongodb* \ | |
mono-complete \ | |
mysql* \ | |
nginx \ | |
node* \ | |
npm* \ | |
nuget \ | |
php* \ | |
postgresql* \ | |
powershell \ | |
r-base \ | |
rpm \ | |
ruby* \ | |
sphinxsearch \ | |
subversion \ | |
yarn \ | |
-yq >/dev/null 2>&1 || true | |
sudo apt-get autoremove -y >/dev/null 2>&1 || true | |
sudo apt-get autoclean -y >/dev/null 2>&1 || true | |
df -h | |
- uses: actions/checkout@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
tags: ghcr.io/ouxt-polaris/ros_handson/ros_handson:latest | |
no-cache: true | |
push: ${{ github.event_name != 'pull_request' }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max |