|
1 | 1 | # coder-server |
2 | | -A lightweight Alpine docker image that runs openvscode-server (vscode accessible by web) |
| 2 | +--- |
| 3 | +This is my opinionated attempt to build a lightweight docker image to run [openvscode-server](https://github.com/gitpod-io/openvscode-server). Think vscode, on the browser. |
| 4 | +# Features |
| 5 | + |
| 6 | +1. Based on my [coder-core](https://github.com/raonigabriel/coder-core) instead of Ubuntu. This translates to [musl being used instead of glib](https://wiki.musl-libc.org/functional-differences-from-glibc.html), but compatibility libraries are also preinstalled. |
| 7 | +2. Its is Alpine, but using **bash** instead of **ash**. |
| 8 | +3. By using **tini**, we ensure that child processes are correctly reaped. |
| 9 | +4. Default user **coder** and group **coder** using UID and GID = 1000, to ease volume-mapping permissions issues. |
| 10 | +5. Passwordless, **sudo** support: easily install extra packages with apk (e.g, ```sudo apk add docker-cli jq```) |
| 11 | +6. Preinstalled [cloudflare tunnel client](https://github.com/cloudflare/cloudflared), like ngrok but free!! This allows you to create reverse tunnels (when your are behind nat). See their docs [here](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps) |
| 12 | +7. Preinstalled tooling (node, npm, git, curl, socat, openssh-client, nano, unzip, brotli, zstd, xz) !!! |
| 13 | +8. Image is hosted on [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry), hence no Dockerhub caps. |
| 14 | + |
| 15 | +# Guidelines that I follow |
| 16 | + - Whenever possible, install software directly from the Alpine repositories, i.e. use apk instead of downloading / manually installing them. |
| 17 | + - Keep it small: do not cross the 250MB image size boundary. |
| 18 | +- Multi arch (amd64 && arm64) |
| 19 | +# Security notice |
| 20 | +1. By default this image is **not with running with HTTPS** but HTTP instead. Its your responsibility to add a reverse-proxy to do that. If you dont, keep in mind that some issues may arise, regarding service workers on the browser. This is because they [need HTTPS](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#setting_up_to_play_with_service_workers) to work properly. |
| 21 | +2. By default this image has **no security enforced** (user / password). Its your responsibility to add a reverse-proxy to do that. |
| 22 | +# Usage |
| 23 | + |
| 24 | +``` |
| 25 | +# docker run -d -p 8000:8000 ghcr.io/raonigabriel/coder-server:latest |
| 26 | +``` |
| 27 | +Then, point your browser to [http://localhost:8000](http://localhost:8000) |
| 28 | +# Creating your own derived image (Java example) |
| 29 | + |
| 30 | +```Dockerfile |
| 31 | +FROM ghcr.io/raonigabriel/coder-server:latest |
| 32 | + |
| 33 | +# Setup env variables |
| 34 | +ENV JAVA_HOME=/usr/lib/jvm/default-jvm \ |
| 35 | + MAVEN_HOME=/usr/share/java/maven-3 \ |
| 36 | + GRADLE_HOME=/usr/share/java/gradle |
| 37 | + |
| 38 | +# Installing Java and tools |
| 39 | +RUN sudo apk --no-cache add maven gradle && \ |
| 40 | +# Installing Java extensions |
| 41 | + sudo openvscode-server --install-extension vscjava.vscode-java-pack vscjava.vscode-gradle vscjava.vscode-spring-initializr |
| 42 | +``` |
| 43 | +--- |
| 44 | +## Licenses |
| 45 | +[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) |
| 46 | + |
| 47 | +--- |
| 48 | +## Disclaimer |
| 49 | +* I am **not** sponsored neither work for cloudflare. I just happen to use their services, because they are cool! |
| 50 | +* This code comes with no warranty. Use it at your own risk. |
| 51 | +* I don't like Apple. Fuck off, fan-boys. |
| 52 | +* I don't like left-winged snowflakes. Fuck off, code-covenant. |
| 53 | +* I will call my branches the old way. Long live **master**, fuck-off renaming. |
0 commit comments