Skip to content

Add support for serving via HTTPS #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ Container images are configured using parameters passed at runtime (such as thos
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London |
| `-e PASSWORD=password` | Optional web gui password, if not provided, there will be no auth. |
| `-e SUDO_PASSWORD=password` | If this optional variable is set, user will have sudo access in the code-server terminal with the specified password. |
| `-e SSL_CERT=/ssl/cert_file.crt` | If this optional variable is provided in conjunction with a key file the code-server run be served via HTTPS. |
| `-e SSL_KEY=/ssl/key_file.key` | If this optional variable is provided in conjunction with a cert file the code-server run be served via HTTPS. |
| `-v /config` | Contains all relevant configuration files. |

## Environment variables from files (Docker secrets)

You can set any environment variable from a file by using a special prepend `FILE__`.
You can set any environment variable from a file by using a special prepend `FILE__`.

As an example:

Expand All @@ -155,9 +157,9 @@ In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as bel
 
## Application Setup

Access the webui at `http://<your-ip>:8443`.
For github integration, drop your ssh key in to `/config/.ssh`.
Then open a terminal from the top menu and set your github username and email via the following commands
Access the webui at `http://<your-ip>:8443`.
For github integration, drop your ssh key in to `/config/.ssh`.
Then open a terminal from the top menu and set your github username and email via the following commands
```
git config --global user.name "username"
git config --global user.email "email address"
Expand Down
8 changes: 8 additions & 0 deletions root/etc/services.d/code-server/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ else
echo "starting with no password"
fi

if [ -n "${SSL_KEY}" ] && [ -n "${SSL_CERT}" ]; then
SSL_CONFIG="--cert ${SSL_CERT} --cert-key ${SSL_KEY}"
else
echo "Running insecurely on HTTP."
SSL_CONFIG=""
fi

exec \
s6-setuidgid abc \
/usr/bin/code-server \
Expand All @@ -16,4 +23,5 @@ exec \
--disable-telemetry \
--disable-updates \
--auth "${AUTH}" \
"${SSL_CONFIG}" \
/config/workspace