|
| 1 | +<p align="center"> |
| 2 | + <img width="400" src="https://raw.githubusercontent.com/BeefBytes/Assets/master/Other/container_illustration/v2/dockerized_vscode.png"> |
| 3 | +</p> |
| 4 | + |
| 5 | +# 📚 About |
| 6 | +There’s already plenty of code-server docker setups out there, what’s the point of this? Well, every single alternative I found was either focused on a specific development environment or it had too much going on, with bunch layers of stuff I was never going to use. |
| 7 | + |
| 8 | +I wanted something barebones and simple, there’s no custom base images, no extra features you’ll never use. The whole image consists of a Dockerfile and entrypoint.sh, that’s it. |
| 9 | + |
| 10 | +The idea behind this setup is running code-server behind Traefik reverse proxy with docker extension installed on vscode. From code-server you’ll be able to spin up any kind of container and develop without ever installing node, python or whatever else on your system. |
| 11 | + |
| 12 | +# 🧰 Getting Started |
| 13 | +The guide assumes you already know basics of docker and docker compose. The reason Traefik and code-server compose files are split up, is to keep things modular in case you already run Traefik on your system. |
| 14 | + |
| 15 | +## Requirements |
| 16 | +- Domain |
| 17 | +- [Docker](https://docs.docker.com/engine/install/#server) |
| 18 | +- Docker Compose (comes with Docker Engine now) |
| 19 | + |
| 20 | +# 🏗️ Installation |
| 21 | + |
| 22 | +### Preparations / Setting up Traefik |
| 23 | +You can skip this part in case you already have Traefik running. However, it may be still useful to look at the configuration on the repo in case you're having issues. |
| 24 | + |
| 25 | +<b>Clone repository</b><br /> |
| 26 | +``` |
| 27 | +git clone https://github.com/EdyTheCow/docker-code-server.git |
| 28 | +``` |
| 29 | + |
| 30 | +<b>Set correct acme.json permissions</b><br /> |
| 31 | + |
| 32 | +Navigate to `_base/data/traefik/` and run |
| 33 | +``` |
| 34 | +sudo chmod 600 acme.json |
| 35 | +``` |
| 36 | + |
| 37 | +<b>Setup basic auth</b><br /> |
| 38 | +Basic auth provides extra layer of security on top of code-server authentication. |
| 39 | +Generate htpasswd and copy it to `_base/data/traefik/.htpasswd` |
| 40 | + |
| 41 | +<b>Start docker compose</b><br /> |
| 42 | +Inside of `_base/compose` run |
| 43 | + ``` |
| 44 | +docker-compose up -d |
| 45 | + ``` |
| 46 | + |
| 47 | +### Setup code-server |
| 48 | + |
| 49 | +<b>Configure variables</b><br /> |
| 50 | + |
| 51 | +Navigate to `code-server/compose/.env` and set these variables |
| 52 | + |
| 53 | +| Variable | Description | |
| 54 | +|-|-| |
| 55 | +| DOMAIN | Domain you're going to use to access the code-server | |
| 56 | +| PASSWORD | Password for code-server | |
| 57 | + |
| 58 | +<b>Configure container user</b><br /> |
| 59 | +The container itself runs a non-root user you'll have to specify in `code-server/compose/docker-compose.yml`. In order to pass docker cli permissions on to container you'll have to specify your docker group ID. |
| 60 | + |
| 61 | +<b>Example: `user: "1000:999"`</b><br /> |
| 62 | +1000 being your user ID and 999 being your docker group ID. |
| 63 | + |
| 64 | +The `DOCKER_USER=${USER}` variable is meant to take your current user's username and pass it on to the container. Meaning you'll have your username from host automatically setup inside container. You can however remove the variable from `docker-compose.yml` alltogether and it will use username `coder` instead. |
| 65 | + |
| 66 | +<b>Start docker compose</b><br /> |
| 67 | + ``` |
| 68 | +docker-compose up -d |
| 69 | + ``` |
| 70 | +You can now navigate to `DOMAIN` you set earlier to access code-server. You can now open terminal and continue setup of zsh and Oh My Zsh. |
| 71 | + |
| 72 | +### Setup Oh My Zsh theme |
| 73 | +By default image installs zsh and Oh My Zsh with a powerlevel10k theme, so you'll have a fancy terminal inside of coder-server. |
| 74 | + |
| 75 | +<b>Install font for Oh My Zsh theme</b><br /> |
| 76 | +Download the font, install it and set it in code-server. You can follow the Visual Studio Code guide provided in the same link as the font.<br /> |
| 77 | +https://github.com/romkatv/powerlevel10k#manual-font-installation |
| 78 | + |
| 79 | +<b>Open .zshrc and change theme to</b><br /> |
| 80 | +`ZSH_THEME="powerlevel10k/powerlevel10k"`<br /> |
| 81 | +You can also use any other theme if you prefer something else. |
| 82 | + |
| 83 | +Installing font for Oh My Zsh theme |
| 84 | +https://github.com/romkatv/powerlevel10k#manual-font-installation |
| 85 | + |
| 86 | +## Post-installation |
| 87 | +You can now install Docker and any other extensions you might want. |
| 88 | + |
| 89 | +### Example of finished set-up |
| 90 | +<p> |
| 91 | + <img width="600" src="https://i.imgur.com/fLjvVRn.png"> |
| 92 | +</p> |
| 93 | + |
| 94 | +# 🐛 Known issues |
| 95 | +- None so far 👀 |
| 96 | + |
0 commit comments