commit 76ad8d62bd6b75a35e3cf4f432ca4613b019ae94 Author: Dennis Schwerdel Date: Wed Apr 14 20:22:51 2021 +0200 Initial version diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6bbcb32 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +test/* +.git/* +screenshots/* + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d570088 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules/ + diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..55629eb --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,2 @@ +[0.1.0] +* First version diff --git a/CloudronManifest.json b/CloudronManifest.json new file mode 100644 index 0000000..13cf59d --- /dev/null +++ b/CloudronManifest.json @@ -0,0 +1,27 @@ +{ + "id": "com.coder.codeserver.cloudronapp", + "title": "VS Code", + "author": "Dennis Schwerdel", + "description": "file://DESCRIPTION.md", + "tagline": "Visual Studio Code in the browser", + "tags": [ + ], + "version": "3.9.3", + "healthCheckPath": "/healthz", + "httpPort": 8080, + "manifestVersion": 1, + "website": "https://github.com/cdr/code-server", + "contactEmail": "support@cloudron.io", + "icon": "logo.png", + "addons": { + "localstorage": {} + }, + "capabilities": [ + ], + "minBoxVersion": "1.8.1", + "tcpPorts": {}, + "udpPorts": {}, + "mediaLinks": [ + ], + "changelog": "file://CHANGELOG" +} diff --git a/DESCRIPTION.md b/DESCRIPTION.md new file mode 100644 index 0000000..1206058 --- /dev/null +++ b/DESCRIPTION.md @@ -0,0 +1,3 @@ +### VS Code + +Run VS Code on any machine anywhere and access it in the browser. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9488564 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM cloudron/base:3.0.0 +MAINTAINER Dennis Schwerdel + +ENV VERSION=3.9.3 + +RUN mkdir -p /app/code + +WORKDIR /app/code + +RUN curl -fsSL https://code-server.dev/install.sh | sh -s -- --version ${VERSION} +ADD config.yaml /app/code/default-config.yaml + +RUN mv /home/cloudron /app/code/default-home \ + && ln -s /app/data /home/cloudron +WORKDIR /app/data +ENV HOME=/app/data + +ADD start.sh /app/code/start.sh + +CMD [ "/app/code/start.sh" ] + diff --git a/README.md b/README.md new file mode 100644 index 0000000..c3febbd --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# VS Code Cloudron App + +This repository contains the Cloudron app package source for VS Code. + +## Installation + +[![Install](https://cloudron.io/img/button.svg)](https://cloudron.io/button.html?app=com.coder.code-server.cloudronapp) + +or using the [Cloudron command line tooling](https://cloudron.io/references/cli.html) + +``` +cloudron install --appstore-id com.coder.code-server.cloudronapp +``` + +## Building + +The app package can be built using the [Cloudron command line tooling](https://cloudron.io/references/cli.html). + +``` +cd vscode-app + +cloudron build +cloudron install +``` diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..0f538d1 --- /dev/null +++ b/config.yaml @@ -0,0 +1,4 @@ +bind-addr: 0.0.0.0:8080 +auth: password +password: %PASSWORD% +cert: false diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..bfe3d9e Binary files /dev/null and b/logo.png differ diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..32e8bc2 --- /dev/null +++ b/start.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -eu + +mkdir -p /app/data/vscode/{config,data} /app/data/{.config,.local/share} + +for file in $(ls /app/code/default-home -A); do + if ! [ -f /app/data/$file ]; then + cp -a /app/code/default-home/$file /app/data/$file + fi +done + +if ! [ -e /app/data/.config/code-server ]; then + ln -s /app/data/vscode/config /app/data/.config/code-server +fi +if ! [ -e /app/data/.local/share/code-server ]; then + ln -s /app/data/vscode/data /app/data/.local/share/code-server +fi +if ! [ -f /app/data/vscode/config/config.yaml ]; then + cp /app/code/default-config.yaml /app/data/vscode/config/config.yaml + PASSWORD=$(dd if=/dev/urandom bs=1 count=12 2>/dev/null | base64) + sed -i "s/%PASSWORD%/${PASSWORD}/g" /app/data/vscode/config/config.yaml + echo "Generated random password: ${PASSWORD}" +fi + +chown -R cloudron: /app/data + +grep -e '^password' --color=never /app/data/vscode/config/config.yaml + +exec sudo -u cloudron code-server