-
Notifications
You must be signed in to change notification settings - Fork 59
173 lines (168 loc) · 6.48 KB
/
build-push-containers.yml
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: build-push-containers
on:
release:
types: [published]
push:
branches:
- 'main'
- 'og-develop'
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Check disk space
run: df . -h
-
name: Free disk space
run: |
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 /opt/hostedtoolcache/CodeQL || true
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"
-
name: Check disk space
run: |
df . -h
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to NVCR
uses: docker/login-action@v3
with:
registry: nvcr.io
username: ${{ secrets.NVCR_USERNAME }}
password: ${{ secrets.NVCR_PASSWORD }}
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
-
name: Metadata for prod Image
id: meta-prod
uses: docker/metadata-action@v5
with:
images: |
stanfordvl/omnigibson
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
-
name: Metadata for dev Image
id: meta-dev
uses: docker/metadata-action@v5
with:
images: |
stanfordvl/omnigibson-dev
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
-
name: Metadata for vscode Image
id: meta-vscode
uses: docker/metadata-action@v5
with:
images: |
stanfordvl/omnigibson-vscode
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
-
name: Metadata for actions Image
id: meta-actions
uses: docker/metadata-action@v5
# The actions image should only be built if the push is to og-develop
if: github.ref == 'refs/heads/og-develop'
with:
images: |
stanfordvl/omnigibson-gha
tags: |
# We only push to the latest tag for the actions image
type=raw,value=latest
-
name: Build and push prod image
id: build-prod
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta-prod.outputs.tags }}
labels: ${{ steps.meta-prod.outputs.labels }}
file: docker/prod.Dockerfile
cache-from: type=registry,ref=stanfordvl/omnigibson:build-cache
cache-to: type=registry,ref=stanfordvl/omnigibson:build-cache,mode=max
-
name: Build and push dev image
id: build-dev
uses: docker/build-push-action@v5
with:
context: .
build-args: "DEV_MODE=1"
push: true
tags: ${{ steps.meta-dev.outputs.tags }}
labels: ${{ steps.meta-dev.outputs.labels }}
file: docker/prod.Dockerfile
cache-from: type=registry,ref=stanfordvl/omnigibson:build-cache # OK to share cache here.
cache-to: type=registry,ref=stanfordvl/omnigibson:build-cache,mode=max
- name: Update vscode image Dockerfile with prod image tag
run: |
sed -i "s/omnigibson:latest/omnigibson@${{ steps.build-prod.outputs.digest }}/g" docker/vscode.Dockerfile && cat docker/vscode.Dockerfile
-
name: Build and push vscode image
id: build-vscode
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta-vscode.outputs.tags }}
labels: ${{ steps.meta-vscode.outputs.labels }}
file: docker/vscode.Dockerfile
cache-from: type=registry,ref=stanfordvl/omnigibson:build-cache # OK to share cache here.
cache-to: type=registry,ref=stanfordvl/omnigibson:build-cache,mode=max
- name: Update actions image Dockerfile with dev image tag
# The actions image should only be built if the push is to og-develop
if: github.ref == 'refs/heads/og-develop'
run: |
sed -i "s/omnigibson-dev:og-develop/omnigibson-dev@${{ steps.build-dev.outputs.digest }}/g" docker/gh-actions/Dockerfile && cat docker/gh-actions/Dockerfile
-
name: Build and push actions image
id: build-actions
uses: docker/build-push-action@v5
# The actions image should only be built if the push is to og-develop
if: github.ref == 'refs/heads/og-develop'
with:
context: docker/gh-actions
push: true
tags: ${{ steps.meta-actions.outputs.tags }}
labels: ${{ steps.meta-actions.outputs.labels }}
file: docker/gh-actions/Dockerfile
cache-from: type=registry,ref=stanfordvl/omnigibson:build-cache # OK to share cache here.
cache-to: type=registry,ref=stanfordvl/omnigibson:build-cache,mode=max