@@ -16,138 +16,72 @@ jobs:
1616
1717 build :
1818 name : build
19- runs-on : ubuntu-22.04
2019 strategy :
2120 fail-fast : false
2221 matrix :
23- dist : ['libc-ubi8', 'libc-ubi9', 'musl' ]
22+ dist : [ 'libc-ubi8' ]
2423 arch : ['amd64']
24+ runs-on : ubuntu-22.04
2525 steps :
26-
27- - name : Checkout che-code source code
28- uses : actions/checkout@v4
29-
30- - name : Cleanup docker images
31- run : |
32- docker system prune -af
33-
34- - name : Compile che-code
35- run : |
36- docker buildx build \
37- --platform linux/${{matrix.arch}} \
38- --progress=plain \
39- -f build/dockerfiles/linux-${{matrix.dist}}.Dockerfile \
40- -t linux-${{matrix.dist}}-${{matrix.arch}} .
41-
42- - name : Display docker images
43- run : |
44- docker images
45-
46- - name : Compress image to a file
47- run : |
48- docker save linux-${{matrix.dist}}-${{matrix.arch}} | gzip > linux-${{matrix.dist}}-${{matrix.arch}}.tgz
49-
50- - name : Upload image artifact
51- uses : actions/upload-artifact@v4
26+ - name : Checkout
27+ uses : actions/checkout@v3
28+ - name : Set up QEMU
29+ uses : docker/setup-qemu-action@v2
30+ - name : Set up Docker Buildx
31+ uses : docker/setup-buildx-action@v2
32+ - name : Docker Build
33+ env :
34+ # https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
35+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36+ run : |
37+ docker buildx build --memory-swap -1 --memory 10g --platform linux/${{matrix.arch}} -f build/dockerfiles/linux-${{matrix.dist}}.Dockerfile --load -t linux-${{matrix.dist}}-${{matrix.arch}} .
38+ - name : Upload image
39+ uses : ishworkh/container-image-artifact-upload@v2.0.0
5240 with :
53- name : linux-${{matrix.dist}}-${{matrix.arch}}
54- path : linux-${{matrix.dist}}-${{matrix.arch}}.tgz
41+ image : " linux-${{matrix.dist}}-${{matrix.arch}}"
5542
5643 assemble :
5744 name : assemble
58- runs-on : ubuntu-22.04
5945 needs : build
46+ runs-on : ubuntu-22.04
6047 steps :
61-
62- - name : Checkout che-code source code
63- uses : actions/checkout@v4
64-
65- - name : Cleanup docker images
48+ - name : Set variables
6649 run : |
67- docker system prune -af
50+ # BRANCH_NAME=${{ github.ref }}
51+ BRANCH_NAME="main"
52+ echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
53+ - name : Checkout
54+ uses : actions/checkout@v3
6855
69- - name : Download editor artifacts
70- uses : actions/download- artifact@v4
56+ - name : Download linux-libc-ubi8-amd64 image
57+ uses : ishworkh/container-image- artifact-download@v2.0.0
7158 with :
72- pattern : linux-*
73- merge-multiple : true
74- path : .
59+ image : " linux-libc-ubi8-amd64"
7560
76- - name : List downloaded files
77- run : |
78- ls -lah
61+ # - name: Download linux-libc-ubi9-amd64 image
62+ # uses: ishworkh/container-image-artifact-download@v2.0.0
63+ # with:
64+ # image: "linux-libc-ubi9-amd64"
7965
80- - name : Load docker images
81- run : |
82- docker load -i linux-libc-ubi8-amd64.tgz
83- docker load -i linux-libc-ubi9-amd64.tgz
84- docker load -i linux-musl-amd64.tgz
66+ # - name: Download linux-musl image
67+ # uses: ishworkh/container-image-artifact-download@v2.0.0
68+ # with:
69+ # image: "linux-musl-amd64"
8570
8671 - name : Display docker images
8772 run : |
8873 docker images
89-
90- - name : Assemble che-code
91- run : |
92- docker buildx build \
93- --platform linux/amd64 \
94- --progress=plain \
95- -f build/dockerfiles/assembly.Dockerfile \
96- -t che-code .
97-
98- - name : Display docker images
99- run : |
100- docker images
101-
102- - name : Compress image to a file
103- run : |
104- docker save che-code | gzip > che-code.tgz
105-
106- - name : Upload image artifact
107- uses : actions/upload-artifact@v4
108- with :
109- name : che-code
110- path : che-code.tgz
111-
112- - name : Store PR info
113- run : |
114- echo "${{ github.event.number }}" > PR_NUMBER
115-
116- - name : Upload PR Number artifact
117- uses : actions/upload-artifact@v4
118- with :
119- name : pull-request-number
120- path : PR_NUMBER
121-
122- dev :
123- name : build-che-dev-image
124- runs-on : ubuntu-22.04
125- steps :
126- - name : Checkout che-code source code
127- uses : actions/checkout@v4
128-
129- - name : Cleanup docker images
130- run : |
131- docker system prune -af
132-
133- - name : Build Che-Code Docker image
134- run : |
135- docker buildx build \
136- --platform linux/amd64 \
137- --progress=plain \
138- -f build/dockerfiles/dev.Dockerfile \
139- -t che-dev .
140-
141- - name : Display docker images
142- run : |
143- docker images
144-
145- - name : Compress che-dev image to a file
146- run : |
147- docker save che-dev | gzip > che-dev.tgz
148-
149- - name : Upload che-dev docker image artifact
150- uses : actions/upload-artifact@v4
74+ - name : Login to Quay.io
75+ uses : docker/login-action@v2
15176 with :
152- name : che-dev
153- path : che-dev.tgz
77+ registry : quay.io
78+ username : ${{ secrets.QUAY_USERNAME }}
79+ password : ${{ secrets.QUAY_PASSWORD }}
80+ - name : Docker Build and Push
81+ run : |
82+ SHORT_SHA1=$(git rev-parse --short=7 HEAD)
83+ if [[ ${{ env.BRANCH_NAME }} == main ]]; then
84+ docker buildx build --platform linux/amd64 -f build/dockerfiles/assembly.Dockerfile -t quay.io/che-incubator/che-code:insiders -t quay.io/che-incubator/che-code:next -t quay.io/che-incubator/che-code:insiders-${SHORT_SHA1} .
85+ elif [[ ${{ env.BRANCH_NAME }} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
86+ docker buildx build --platform linux/amd64 -f build/dockerfiles/assembly.Dockerfile -t quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }} -t quay.io/che-incubator/che-code:latest .
87+ fi
0 commit comments