-
Notifications
You must be signed in to change notification settings - Fork 6
111 lines (95 loc) · 3.1 KB
/
Copy pathdocker-publish.yaml
File metadata and controls
111 lines (95 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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:
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
if [ "$(docker image ls -aq)" ]; then
docker rmi $(docker image ls -aq)
else
echo "No Docker images to remove."
fi
df -h
- name: Checkout code
uses: nschloe/action-cached-lfs-checkout@v1.2.2
with:
exclude: "scoutbot/*/models/pytorch/"
- uses: docker/setup-qemu-action@v3.3.0
name: Set up QEMU
id: qemu
with:
image: tonistiigi/binfmt:latest
platforms: all
- uses: docker/setup-buildx-action@v3.8.0
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@v3
with:
username: wildmeorg
password: ${{ secrets.WBIA_WILDMEBOT_DOCKER_HUB_TOKEN }}
# Push tagged image 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 to registries
- name: Bleeding Edge Docker Hub
if: github.ref == 'refs/heads/main'
run: echo "IMAGE_TAG=main" >> $GITHUB_ENV
# Push nightly image to registries
- name: Nightly Docker Hub
if: github.event_name == 'schedule'
run: echo "IMAGE_TAG=nightly" >> $GITHUB_ENV
# Build and push images
- name: Build Scoutbot
run: |
docker buildx build \
-t wildme/scoutbot:${{ env.IMAGE_TAG }} \
--platform linux/amd64 \
--push \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
.
- name: Also push latest image
if: ${{ github.event_name == 'push'}}
run: |
docker buildx build \
-t wildme/scoutbot:latest \
--platform linux/amd64 \
--push \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
.
- name: Trigger Scout Build
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GHCR_PAT }}
repository: WildMeOrg/scout
event-type: build-trigger