From c25fc4dc386c1afae91acb8b023cfbb4de143352 Mon Sep 17 00:00:00 2001 From: BoykoAlex Date: Wed, 12 Jun 2019 13:36:07 -0400 Subject: [PATCH] Theia spring boot ide docker file and k8s deployment (initial work) --- theia-extensions/k8s-app/Dockerfile | 32 +++++++++++++++++++++ theia-extensions/k8s-app/deploy.sh | 5 ++++ theia-extensions/k8s-app/deploy.yml | 40 +++++++++++++++++++++++++++ theia-extensions/k8s-app/package.json | 37 +++++++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 theia-extensions/k8s-app/Dockerfile create mode 100755 theia-extensions/k8s-app/deploy.sh create mode 100644 theia-extensions/k8s-app/deploy.yml create mode 100644 theia-extensions/k8s-app/package.json diff --git a/theia-extensions/k8s-app/Dockerfile b/theia-extensions/k8s-app/Dockerfile new file mode 100644 index 000000000..a39248dc8 --- /dev/null +++ b/theia-extensions/k8s-app/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu:18.04 + +RUN apt-get update && apt-get install -y \ + build-essential \ + gettext-base \ + git \ + jq \ + openjdk-8-jdk=8u162-b12-1 openjdk-8-jre=8u162-b12-1 openjdk-8-jdk-headless=8u162-b12-1 openjdk-8-jre-headless=8u162-b12-1 openjdk-8-source=8u162-b12-1 \ + curl + +RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \ + && apt-get install -y nodejs + +RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ + && apt-get update \ + && apt-get install -y yarn + +RUN adduser --disabled-password --gecos '' theia +RUN chmod g+rw /home && \ + mkdir -p /home/project && \ + chown -R theia:theia /home/theia && \ + chown -R theia:theia /home/project; +WORKDIR /home/theia +USER theia + +ADD package.json ./package.json +RUN yarn --cache-folder ./ycache && rm -rf ./ycache +RUN yarn theia build +EXPOSE 3000 +ENV SHELL /bin/bash +ENTRYPOINT [ "yarn", "theia", "start", "/home/project", "--hostname=0.0.0.0" ] \ No newline at end of file diff --git a/theia-extensions/k8s-app/deploy.sh b/theia-extensions/k8s-app/deploy.sh new file mode 100755 index 000000000..657f95752 --- /dev/null +++ b/theia-extensions/k8s-app/deploy.sh @@ -0,0 +1,5 @@ +git_repo=$1 +clone_folder="${git_repo##*/}" +rm -rf ${clone_folder} +git clone ${git_repo} +docker run -it -p 3000:3000 -v "$(pwd)/${clone_folder}:/home/project" $2 \ No newline at end of file diff --git a/theia-extensions/k8s-app/deploy.yml b/theia-extensions/k8s-app/deploy.yml new file mode 100644 index 000000000..ab5b64d36 --- /dev/null +++ b/theia-extensions/k8s-app/deploy.yml @@ -0,0 +1,40 @@ +apiVersion: v1 +kind: Deployment +metadata: + name: theia-spring-boot +spec: + replicas: 1 + selector: + matchLabels: + name: theia-spring-boot + template: + metadata: + labels: + name: theia-spring-boot + spec: + containers: + - name: theia-spring-boot + image: theia-spring-boot + ports: + - containerPort: 3000 + volumeMounts: + - name: source + mountPath: /home/project + - name: git-sync + image: k8s.gcr.io/git-sync-amd64:v2.0.6 + imagePullPolicy: Always + volumeMounts: + - name: source + mountPath: /home + env: + - name: GIT_SYNC_REPO + value: https://github.com/spring-projects/spring-petclinic.git + - name: GIT_SYNC_BRANCH + value: master + - name: GIT_SYNC_ROOT + value: /home + - name: GIT_SYNC_DEST + value: /home + volumes: + - name: source + emptyDir: {} diff --git a/theia-extensions/k8s-app/package.json b/theia-extensions/k8s-app/package.json new file mode 100644 index 000000000..fb6b92bb8 --- /dev/null +++ b/theia-extensions/k8s-app/package.json @@ -0,0 +1,37 @@ +{ + "private": true, + "name": "browser-app", + "version": "0.0.0", + "dependencies": { + "@pivotal-tools/theia-spring-boot": "latest", + "@theia/core": "latest", + "@theia/editor": "latest", + "@theia/file-search": "latest", + "@theia/filesystem": "latest", + "@theia/git": "latest", + "@theia/java": "latest", + "@theia/languages": "latest", + "@theia/markers": "latest", + "@theia/messages": "latest", + "@theia/monaco": "latest", + "@theia/navigator": "latest", + "@theia/outline-view": "latest", + "@theia/preferences": "latest", + "@theia/process": "latest", + "@theia/search-in-workspace": "latest", + "@theia/terminal": "latest", + "@theia/textmate-grammars": "latest", + "@theia/workspace": "latest" + }, + "devDependencies": { + "@theia/cli": "latest" + }, + "scripts": { + "prepare": "theia build", + "start": "theia start", + "watch": "theia build --watch" + }, + "theia": { + "target": "browser" + } +}