Skip to content

Docker

Docker #276

name: Docker
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- v*
schedule:
- cron: '0 16 * * *' # Every day at 16:00 UTC (~09:00 PT)
jobs:
# Push container image to GitHub Packages and Docker Hub.
# See also https://docs.docker.com/docker-hub/builds/
deploy:
name: Docker image build
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- name: Free Disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo rm -rf /opt/hostedtoolcache
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Checkout code
uses: nschloe/[email protected]
with:
exclude: "scoutbot/*/models/pytorch/"
- uses: docker/setup-qemu-action@v1
name: Set up QEMU
id: qemu
with:
image: tonistiigi/binfmt:latest
platforms: all
- uses: docker/setup-buildx-action@v1
name: Set up Docker Buildx
id: buildx
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: set default docker build version
run: echo "IMAGE_TAG=nightly" >> $GITHUB_ENV
# Log into container registries
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: wildmeorg
password: ${{ secrets.WBIA_WILDMEBOT_DOCKER_HUB_TOKEN }}
# Push tagged image (version tag + latest) to registries
- name: Tagged Docker Hub
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
run: |
VERSION=$(echo ${GITHUB_REF} | sed 's#.*/v##')
echo "IMAGE_TAG=${VERSION}" >> $GITHUB_ENV
# Push bleeding-edge image (main tag) to registries
- name: Bleeding Edge Docker Hub
if: github.ref == 'refs/heads/main'
run: |
echo "IMAGE_TAG=main" >> $GITHUB_ENV
# Push nightly image (nightly tag) to registries
- name: Nightly Docker Hub
if: github.event_name == 'schedule'
run: |
echo "IMAGE_TAG=nightly" >> $GITHUB_ENV
# Build images
- name: Build Codex
run: |
docker buildx build \
-t wildme/scoutbot:${{ env.IMAGE_TAG }} \
--platform linux/amd64 \
--push \
.
# Also push latest image
- name: Build Codex
if: ${{ github.event_name == 'push'}}
run: |
docker buildx build \
-t wildme/scoutbot:latest \
--platform linux/amd64 \
--push \
.
- name: Trigger Scout Build
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GHCR_PAT }}
repository: WildMeOrg/scout # Adjust to the actual repository name
event-type: build-trigger # You can choose any custom event type