-
Notifications
You must be signed in to change notification settings - Fork 744
165 lines (162 loc) · 5.73 KB
/
build.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
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'
concurrency:
group: build-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
cancel-in-progress: true
env:
BUILDKIT_PROGRESS: plain
jobs:
base:
runs-on: ubuntu-20.04${{ ((github.event_name != 'schedule') && '-8core') || '' }}
timeout-minutes: 90
steps:
- name: enable experimental docker features
run: |
sudo bash -c 'echo "{ \"cgroup-parent\": \"/actions_job\",\"experimental\":true}" > /etc/docker/daemon.json'
sudo service docker restart
docker version -f '{{.Server.Experimental}}'
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: build slim image
run: |
cd image && ruby auto_build.rb base_slim
- name: tag slim images
id: tag-images
run: |
TAG=`date +%Y%m%d-%H%M`
echo "tag=$(echo $TAG)" >> $GITHUB_OUTPUT
docker tag discourse/base:build_slim discourse/base:2.0.$TAG-slim
docker tag discourse/base:build_slim discourse/base:slim
- name: build release image
run: |
cd image && ruby auto_build.rb base
- name: tag release images
run: |
TAG=${{ steps.tag-images.outputs.tag }}
docker tag discourse/base:build discourse/base:2.0.$TAG
docker tag discourse/base:build discourse/base:release
- name: build test_build image
run: |
cd image && ruby auto_build.rb discourse_test_build
- name: run specs
run: |
docker run --rm -e RUBY_ONLY=1 -e USE_TURBO=1 -e SKIP_PLUGINS=1 -e SKIP_LINT=1 discourse/discourse_test:build
- name: Print summary
run: |
docker images discourse/base
- name: push to dockerhub
if: success() && (github.ref == 'refs/heads/main')
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
TAG=${{ steps.tag-images.outputs.tag }}
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
docker push discourse/base:2.0.$TAG-slim
docker push discourse/base:slim
docker push discourse/base:2.0.$TAG
docker push discourse/base:release
test:
runs-on: ubuntu-20.04${{ ((github.event_name != 'schedule') && '-8core') || '' }}
timeout-minutes: 30
needs: base
defaults:
run:
working-directory: image/discourse_test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: build discourse_test:slim
run: |
docker buildx build . --load \
--build-arg from_tag=slim \
--target base \
--tag discourse/discourse_test:slim
- name: build discourse_test:slim-browsers
run: |
docker buildx build . --load \
--build-arg from_tag=slim \
--target with_browsers \
--tag discourse/discourse_test:slim-browsers
- name: build discourse_test:release
run: |
docker buildx build . --load \
--build-arg from_tag=release \
--target release \
--tag discourse/discourse_test:release
- name: Print summary
run: |
docker images discourse/discourse_test
- name: push to dockerhub
if: success() && (github.ref == 'refs/heads/main')
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
docker push discourse/discourse_test:slim
docker push discourse/discourse_test:slim-browsers
docker push discourse/discourse_test:release
dev:
runs-on: ubuntu-20.04${{ ((github.event_name != 'schedule') && '-8core') || '' }}
timeout-minutes: 30
needs: base
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: build discourse_dev image
run: |
cd image && ruby auto_build.rb discourse_dev
- name: push to dockerhub
if: success() && (github.ref == 'refs/heads/main')
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
docker tag discourse/discourse_dev:build discourse/discourse_dev:release
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
docker push discourse/discourse_dev:release
aarch64:
runs-on: ubuntu-latest
needs: base
services:
registry:
image: registry
ports:
- 5000:5000
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: build slim image
working-directory: image/base
run: |
docker buildx build . --load \
-f slim.Dockerfile \
--platform linux/arm64 \
--tag discourse/base:aarch64-slim
docker tag discourse/base:aarch64-slim localhost:5000/discourse/base:aarch64-slim
docker push localhost:5000/discourse/base:aarch64-slim
- name: tag slim image as release
working-directory: image/base
run: |
docker tag discourse/base:aarch64-slim discourse/base:aarch64
- name: Print summary
run: docker images discourse/base
- name: push to dockerhub
if: success() && (github.ref == 'refs/heads/main')
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
docker push discourse/base:aarch64