Skip to content

Commit 9219c3e

Browse files
committed
Build containers with GHA
- Increase clangd timeout to 150 minutes
1 parent 1416a68 commit 9219c3e

15 files changed

+252
-26
lines changed

.github/workflows/actions.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
pull_request:
1010
branches:
1111
- main
12+
workflow_dispatch:
1213

1314
jobs:
1415
build:

.github/workflows/ls-clangd.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Clangd LS Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
REPO_NAME: ${{ github.repository }}
9+
PATH_CONTEXT: ./packages/examples/resources/clangd
10+
CONTAINER_NAME_CONFIGURE: clangd-wasm-configure
11+
CONTAINER_NAME_BUILD: clangd-wasm-build
12+
13+
jobs:
14+
images-clangd-wasm:
15+
name: Build & Deploy Clangd LS
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: read
20+
packages: write
21+
attestations: write
22+
id-token: write
23+
24+
timeout-minutes: 150
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata (configure)
37+
id: meta_configure
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: |
41+
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_CONFIGURE }}
42+
# enforce latest tag for now
43+
tags: |
44+
type=raw,value=latest
45+
46+
- name: Build & Push (configure)
47+
id: push_configure
48+
uses: docker/build-push-action@v6
49+
with:
50+
context: ${{ env.PATH_CONTEXT }}
51+
file: ${{ env.PATH_CONTEXT }}/configure.Dockerfile
52+
push: true
53+
tags: ${{ steps.meta_configure.outputs.tags }}
54+
labels: ${{ steps.meta_configure.outputs.labels }}
55+
56+
- name: Attest (configure)
57+
uses: actions/attest-build-provenance@v1
58+
with:
59+
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_CONFIGURE }}
60+
subject-digest: ${{ steps.push_configure.outputs.digest }}
61+
push-to-registry: true
62+
63+
- name: Extract metadata (build)
64+
id: meta_build
65+
uses: docker/metadata-action@v5
66+
with:
67+
images: |
68+
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_BUILD }}
69+
# enforce latest tag for now
70+
tags: |
71+
type=raw,value=latest
72+
73+
- name: Build & Push (build)
74+
id: push_build
75+
uses: docker/build-push-action@v6
76+
with:
77+
context: ${{ env.PATH_CONTEXT }}
78+
file: ${{ env.PATH_CONTEXT }}/build.Dockerfile
79+
push: true
80+
tags: ${{ steps.meta_build.outputs.tags }}
81+
labels: ${{ steps.meta_build.outputs.labels }}
82+
83+
- name: Attest (build)
84+
uses: actions/attest-build-provenance@v1
85+
with:
86+
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_BUILD }}
87+
subject-digest: ${{ steps.push_build.outputs.digest }}
88+
push-to-registry: true

.github/workflows/ls-eclipsejdt.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Eclipse JDT LS Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
REPO_NAME: ${{ github.repository }}
9+
PATH_CONTEXT: ./packages/examples/resources/eclipse.jdt.ls
10+
CONTAINER_NAME: eclipse.jdt.ls
11+
12+
jobs:
13+
image-eclipsejdtls:
14+
name: Build & Deploy Eclipse JDT LS
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
attestations: write
21+
id-token: write
22+
23+
timeout-minutes: 15
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: |
40+
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
41+
# enforce latest tag for now
42+
tags: |
43+
type=raw,value=latest
44+
45+
- name: Build & Push
46+
id: push
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
file: ${{ env.PATH_CONTEXT }}/Dockerfile
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
55+
- name: Attest
56+
uses: actions/attest-build-provenance@v1
57+
with:
58+
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
59+
subject-digest: ${{ steps.push.outputs.digest }}
60+
push-to-registry: true

.github/workflows/ls-groovy.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Groovy LS Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
REPO_NAME: ${{ github.repository }}
9+
PATH_CONTEXT: ./packages/examples/resources/groovy
10+
CONTAINER_NAME: groovy.ls
11+
12+
jobs:
13+
image-groovyls:
14+
name: Build & Deploy Groovy LS
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
attestations: write
21+
id-token: write
22+
23+
timeout-minutes: 15
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: |
40+
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
41+
# enforce latest tag for now
42+
tags: |
43+
type=raw,value=latest
44+
45+
- name: Build & Push
46+
id: push
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
file: ${{ env.PATH_CONTEXT }}/Dockerfile
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
55+
- name: Attest
56+
uses: actions/attest-build-provenance@v1
57+
with:
58+
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
59+
subject-digest: ${{ steps.push.outputs.digest }}
60+
push-to-registry: true

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ npm run start:example:server:python
183183

184184
##### Groovy Language Server
185185

186-
For the **groovy-client** example you need to ensure the **groovy-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Gradle). From the project root run `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml up -d`. First start up will take longer as the container is built. Use `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml down` to stop it.
186+
For the **groovy-client** example you need to ensure the **groovy-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Gradle). From the project root run `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml up -d`. First start up will take longer as the container is downloaded from GitHub's container registry. Use `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml down` to stop it.
187187

188188
##### Java Language Server
189189

190-
For the **java-client** example you need to ensure the **java-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Eclipse JDT LS). From the project root run `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml up -d`. First start up will take longer as the container is built. Use `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml down` to stop it.
190+
For the **java-client** example you need to ensure the **java-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Eclipse JDT LS). From the project root run `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml up -d`. First start up will take longer as the container is downloaded from GitHub's container registry. Use `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml down` to stop it.
191191

192192
### Verification Examples & Usage
193193

packages/examples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"compile": "tsc --build tsconfig.src.json",
117117
"resources:download": "vite-node ./build/downloadResources.mts",
118118
"build:msg": "echo Building main examples:",
119-
"build": "npm run build:msg && npm run clean && npm run resources:download && npm run compile",
119+
"build": "npm run build:msg && npm run clean && npm run resources:download && npm run extract:docker && npm run compile",
120120
"build:bundle": "vite --config vite.bundle.config.ts build",
121121
"start:server:json": "vite-node src/json/server/direct.ts",
122122
"start:server:python": "vite-node src/python/server/direct.ts",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM clangd-clangd-configure
1+
FROM ghcr.io/typefox/monaco-languageclient/clangd-wasm-configure:latest
22

33
COPY build-docker.sh /builder/build-docker.sh
44
COPY wait_stdin.patch /builder/wait_stdin.patch
55

6-
RUN (cd /builder; ./build-docker.sh)
6+
RUN (cd /builder; bash ./build-docker.sh)
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
services:
2-
clangd-build:
2+
clangd-wasm-build:
3+
image: ghcr.io/typefox/monaco-languageclient/clangd-wasm-build:latest
34
build:
45
dockerfile: ./build.Dockerfile
56
context: .
67
# only linux/amd64 for now
78
platforms:
89
- "linux/amd64"
910
platform: linux/amd64
10-
container_name: clangd-build
11+
container_name: clangd-wasm-build

packages/examples/resources/clangd/configure.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ RUN volta install node \
1515
RUN mkdir /builder
1616

1717
COPY configure-docker.sh /builder/configure-docker.sh
18-
RUN (cd /builder; ./configure-docker.sh)
18+
RUN (cd /builder; bash ./configure-docker.sh)
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
services:
2-
clangd-configure:
2+
clangd-wasm-configure:
3+
image: ghcr.io/typefox/monaco-languageclient/clangd-wasm-configure:latest
34
build:
45
dockerfile: ./configure.Dockerfile
56
context: .
67
# only linux/amd64 for now
78
platforms:
89
- "linux/amd64"
910
platform: linux/amd64
10-
container_name: clangd-configure
11+
container_name: clangd-wasm-configure

packages/examples/resources/clangd/scripts/extractDockerFiles.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@ import child_process from "node:child_process";
33

44
const outputDir = './resources/clangd/wasm';
55

6-
// clean always
7-
fs.rmSync(outputDir, {
8-
force: true,
9-
recursive: true
10-
});
11-
fs.mkdirSync(outputDir);
6+
try {
7+
child_process.execFileSync('docker', ['create', '--name', 'extract-clangd', 'ghcr.io/typefox/monaco-languageclient/clangd-wasm-build:latest']);
128

13-
child_process.execFileSync('docker', ['create', '--name', 'extract-clangd', 'clangd-clangd-build']);
14-
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.js', outputDir]);
15-
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.wasm', outputDir]);
16-
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.worker.js', outputDir]);
17-
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.worker.mjs', outputDir]);
18-
child_process.execFileSync('docker', ['rm', 'extract-clangd']);
9+
// clean but only if container start was successful
10+
fs.rmSync(outputDir, {
11+
force: true,
12+
recursive: true
13+
});
14+
fs.mkdirSync(outputDir);
15+
16+
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.js', outputDir]);
17+
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.wasm', outputDir]);
18+
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.worker.js', outputDir]);
19+
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.worker.mjs', outputDir]);
20+
child_process.execFileSync('docker', ['rm', 'extract-clangd']);
21+
} catch (e) {
22+
console.warn('Clangd wasm data was not extracted from container image!');
23+
}

packages/examples/resources/eclipse.jdt.ls/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ RUN mkdir -p ${PATH_MLC}
2121
# copy repo content
2222
COPY ./ ${PATH_MLC}
2323

24+
RUN cd ${PATH_MLC} \
25+
&& npm i \
26+
&& npm run build
27+
2428
# download and extract Eclipse JDT LS in target folder
2529
RUN mkdir -p ${PATH_ECLIPSE_JDT} \
2630
&& cd ${PATH_ECLIPSE_JDT} \
@@ -29,4 +33,4 @@ RUN mkdir -p ${PATH_ECLIPSE_JDT} \
2933

3034
WORKDIR ${PATH_MLC}
3135

32-
CMD ["/bin/bash", "npm i && npm run start:example:server:jdtls"]
36+
CMD ["/bin/bash", "npm run start:example:server:jdtls"]

packages/examples/resources/eclipse.jdt.ls/docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
services:
22
eclipsejdtls:
3+
image: ghcr.io/typefox/monaco-languageclient/eclipse.jdt.ls:latest
34
build:
45
dockerfile: ./packages/examples/resources/eclipse.jdt.ls/Dockerfile
56
context: ../../../..
@@ -10,7 +11,7 @@ services:
1011
# - "linux/arm64"
1112
platform: linux/amd64
1213
command: [
13-
"bash", "-c", "npm i && npm run start:example:server:jdtls"
14+
"bash", "-c", "npm run start:example:server:jdtls"
1415
]
1516
ports:
1617
- 30003:30003

packages/examples/resources/groovy/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ RUN cd ${HOME_DIR} \
2929
# copy repo content
3030
COPY ./ ${PATH_MLC}
3131

32+
RUN cd ${PATH_MLC} \
33+
&& npm i \
34+
&& npm run build
35+
3236
# copy language server to target
3337
RUN mkdir -p ${PATH_GROOVY_JAR} \
3438
&& cp ${PATH_GLS}/build/libs/groovy-language-server-all.jar ${PATH_GROOVY_JAR}
3539

3640
WORKDIR ${PATH_MLC}
3741

38-
CMD ["/bin/bash", "npm i && npm run start:example:server:groovy"]
42+
CMD ["/bin/bash", "npm run start:example:server:groovy"]

packages/examples/resources/groovy/docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
services:
22
groovyls:
3+
image: ghcr.io/typefox/monaco-languageclient/groovy.ls:latest
34
build:
45
dockerfile: ./packages/examples/resources/groovy/Dockerfile
56
context: ../../../..
@@ -10,7 +11,7 @@ services:
1011
# - "linux/arm64"
1112
platform: linux/amd64
1213
command: [
13-
"bash", "-c", "npm i && npm run start:example:server:groovy"
14+
"bash", "-c", "npm run start:example:server:groovy"
1415
]
1516
ports:
1617
- 30002:30002

0 commit comments

Comments
 (0)