-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to build blueprint based on local Theia sources #304
Contributed on behalf of STMicroelectronics Signed-off-by: Johannes Faltermeier <[email protected]>
- Loading branch information
1 parent
764d9ba
commit c134099
Showing
6 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Publish Theia Builder Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- jf/local-theia-build | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: The image's tag | ||
required: true | ||
default: next | ||
|
||
jobs: | ||
build: | ||
name: Build and push theia builder image to Github Packages | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to the Github Container registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./docker/local-theia-build | ||
file: local-theia-build.Dockerfile | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}/blueprint-theia-builder:latest | ||
# ghcr.io/${{ github.repository }}/blueprint-theia-builder:${{ github.event.inputs.tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/expect -f | ||
set timeout 10 | ||
|
||
spawn npm adduser --registry http://localhost:4873/ | ||
match_max 100000 | ||
|
||
expect "Username" | ||
send "dummy-user\r" | ||
|
||
expect "Password" | ||
send "dummy-p4ssword\r" | ||
|
||
expect "Email: (this IS public)" | ||
send "[email protected]\r" | ||
|
||
expect "Logged in on http://localhost:4873/." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ "$#" -eq 0 ] | ||
then | ||
REGISTRY=http://localhost:4873/ | ||
echo "Launching Verdaccio and adding dummy user" | ||
verdaccio --listen http://0.0.0.0:4873 & | ||
VERDACCIO_PID=$! | ||
while ! nc -z localhost 4873; do | ||
sleep 1 | ||
done | ||
expect -f /tmp/adduser | ||
expect -f /tmp/loginuser | ||
else | ||
REGISTRY=$1 | ||
if [ ! "$AUTH_TOKEN" = "" ] | ||
then | ||
echo "Updating npmrc" | ||
echo //$REGISTRY:_authToken=$AUTH_TOKEN >> /.npmrc | ||
fi | ||
fi | ||
|
||
echo "Building Theia" | ||
cd /tmp/theia | ||
npm config set registry $REGISTRY | ||
yarn config set registry $REGISTRY | ||
yarn | ||
yarn build | ||
|
||
|
||
echo "PUBLISH $PUBLISH" | ||
if [ "$PUBLISH" = "true" ] | ||
then | ||
echo "Publishing Theia..." | ||
yarn publish:local:next --registry $REGISTRY || true | ||
fi | ||
|
||
if [ "$#" -eq 0 ] | ||
then | ||
echo "Waiting..." | ||
wait $VERDACCIO_PID | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/expect -f | ||
set timeout 10 | ||
|
||
spawn npm login --registry http://localhost:4873/ | ||
match_max 100000 | ||
|
||
expect "Username" | ||
send "dummy-user\r" | ||
|
||
expect "Password" | ||
send "dummy-p4ssword\r" | ||
|
||
expect "Logged in on http://localhost:4873/." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Prerequisites | ||
# https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisites | ||
FROM node:18.17.0 | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
make \ | ||
gcc \ | ||
pkg-config \ | ||
build-essential \ | ||
libx11-dev \ | ||
libxkbfile-dev \ | ||
libsecret-1-dev && \ | ||
# install local npm registry and helper tools | ||
yarn global add verdaccio && \ | ||
apt-get install -y expect-dev netcat-openbsd && \ | ||
mkdir /tmp/verdaccio && chmod 777 /tmp/verdaccio && \ | ||
# create some common default directories/files with write access for any user | ||
touch /.yarnrc && chmod 777 /.yarnrc && \ | ||
touch /.npmrc && chmod 777 /.npmrc && \ | ||
mkdir /.cache && chmod 777 /.cache && \ | ||
mkdir /.yarn && chmod 777 /.yarn && \ | ||
mkdir /.npm && chmod 777 /.npm | ||
|
||
# Set storage location for verdaccio | ||
ENV VERDACCIO_STORAGE_PATH /tmp/verdaccio | ||
ENV PUBLISH true | ||
|
||
# Switch to expected workdir | ||
WORKDIR /tmp | ||
|
||
COPY adduser /tmp/adduser | ||
COPY loginuser /tmp/loginuser | ||
COPY entrypoint /tmp/entrypoint | ||
|
||
ENTRYPOINT ["/tmp/entrypoint"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Local Theia Build | ||
|
||
## Prerequisites | ||
|
||
You can create an image with all required tools to build theia and to host your temporary next builds with this command: | ||
|
||
```sh | ||
docker build -t local-theia-builder -f local-theia-build.Dockerfile ./docker/local-theia-build | ||
``` | ||
|
||
## Local Build | ||
|
||
```sh | ||
# switch to your checked out theia code | ||
cd ~/git/theia | ||
|
||
# optional: if you built Theia locally before, you may want to clean local changes in order to get a reproducible clean build | ||
# git clean -xfd | ||
|
||
# build Theia with our builder image | ||
docker run --rm \ | ||
-v ${PWD}:/tmp/theia \ | ||
-u $(id -u ${USER}):$(id -g ${USER}) \ | ||
-p=4873:4873 \ | ||
local-theia-builder | ||
|
||
# If you want to keep the results, also mount verdaccio dir: | ||
# -v ${VERDACCIO_STORAGE_PATH}:/tmp/verdaccio | ||
|
||
# in a new shell, open theia blueprint | ||
cd ~/git/theia-blueprint | ||
|
||
# update theia version to @next | ||
yarn && yarn update:next | ||
|
||
# run yarn with verdaccio registry to update yarn.lock | ||
yarn --registry http://localhost:4873/ | ||
|
||
# build theia blueprint | ||
yarn build && yarn electron package | ||
|
||
``` |