Sign inSign up
code-server logo

haskelious/code-server

By haskelious

•Updated 10 months ago

code-server image that allows setup of development environment as normal user using nix commands.

Image
Developer tools
Operating systems
0

523

haskelious/code-server repository overview

⁠Overview

This barebones code-server image includes the core nix commands. This allows any package to be installed through nix-env or other nix commands.

⁠Running the container

⁠Running the container with docker compose

A minimal compose.yml file to start the code-server container:

services:
  code-server:
    image: haskelious/code-server:latest
    environment:
      - PASSWORD=changeme
    ports:
      - "8080:8080"
    restart: unless-stopped

run this with docker compose up and open a browser to http://localhost:8080⁠ using the password changeme when asked.

⁠Folder persistence

Add the following to compose.yml to ensure data persistence:

services:
  code-server:
    image: haskelious/code-server:latest
    [...]
    volumes:
      - code-server:/home/nix

volumes:
  code-server:
⁠Use a trusted certificate

To avoid the invalid certificate warning from the browser, you need to use a proper signed certificate. Create a ./certs folder next to the compose.yml file, and store the certificate into cert.pem and the private key into key.pem in that folder. Add the following to compose.yml to use the trusted certificate with HTTPS:

services:
  code-server:
    image: haskelious/code-server:latest
    [...]
    environment:
      - HTTPS=true
      - CERT=/certs/cert.pem
      - CERTKEY=/certs/key.pem
      - PORT=8443
    ports:
      - "8443:8443"
    volumes:
      - ./certs:/certs

⁠More environment variables

You can add more settings through the environment variables in the compose.yml file:

- PASSWORD=changeme
- HTTPS=true
- HOST=myhost.exanple.com
- CERT=/certs/cert.pem
- CERTKEY=/certs/key.pem
- PORT=8443
- INSECURE=false

⁠Usage of the container

⁠Development environment

You can set up a development environment by installing development tools (python, rust, go, ...). Some examples are provided in scripts located in the /envs/ folder.

To install rust and related tools, use /envs/import_rust.sh

⁠Package installation

Within the container, you can install any package from nixpkgs, for example the gdb package, by using a command similar to

nix-env -f channel:nixpkgs-unstable -iA gdb

⁠Enable package only within a shell session

In order to enter a shell with commands available for you to use within this shell session, for example a python interpreter, use

nix-shell -p python3

Tag summary

Content type

Image

Digest

sha256:59a795e82…

Size

252.4 MB

Last updated

10 months ago

docker pull haskelious/code-server