Skip to content

Commit 34dcfae

Browse files
committed
Build containers with GHA
1 parent 87515ae commit 34dcfae

16 files changed

+257
-20
lines changed

Diff for: .editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ indent_size = 2
1313

1414
[*.md]
1515
indent_size = 2
16+
17+
[*.yml]
18+
indent_size = 2

Diff for: .github/workflows/actions.yml

+1
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:

Diff for: .github/workflows/ls-clangd.yml

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

Diff for: .github/workflows/ls-eclipsejdt.yml

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

Diff for: .github/workflows/ls-groovy.yml

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

Diff for: README.md

+2-2
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

Diff for: packages/examples/package.json

+1-1
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",

Diff for: packages/examples/resources/clangd/build.Dockerfile

+2-2
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)
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

Diff for: packages/examples/resources/clangd/configure.Dockerfile

+1-1
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)
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

Diff for: packages/examples/resources/clangd/scripts/extractDockerFiles.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ fs.rmSync(outputDir, {
1010
});
1111
fs.mkdirSync(outputDir);
1212

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']);
13+
try {
14+
child_process.execFileSync('docker', ['create', '--name', 'extract-clangd', 'ghcr.io/typefox/monaco-languageclient/clangd-wasm-build:latest']);
15+
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.js', outputDir]);
16+
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.wasm', outputDir]);
17+
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.worker.js', outputDir]);
18+
child_process.execFileSync('docker', ['cp', 'extract-clangd:/builder/llvm-project/build/bin/clangd.worker.mjs', outputDir]);
19+
child_process.execFileSync('docker', ['rm', 'extract-clangd']);
20+
} catch (e) {
21+
console.warn('Clangd wasm data was not extracted from container image!');
22+
}

Diff for: packages/examples/resources/eclipse.jdt.ls/Dockerfile

+5-1
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"]

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

+2-1
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

Diff for: packages/examples/resources/groovy/Dockerfile

+5-1
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"]

Diff for: packages/examples/resources/groovy/docker-compose.yml

+2-1
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)