diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2026-07-03 07:56:25 +0200 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2026-07-03 07:56:25 +0200 |
| commit | be775d4675b19b7f033c01f6826da11b16d7288b (patch) | |
| tree | 9880e1b364bf06eae70955cef855f08b0ed800dd | |
| parent | d07d395b09ec1a87677712e7b50ac520495ed573 (diff) | |
Improve Locale Support
Previously, the devbox user would default to the `POSIX` locale
which meant that a lot of minor things around UTF-8 would not
work.
We now update the locale to use one with UTF-8 support; note that
we just use the minimal C locale instead of building one. Users
can (if they chose) use something like `dpkg-reconfigure locales`
and `update-locale` in order to modify their default locale if
they want something else specific.
Additionally, get rid of the annoying known hosts warning, by
keeping a devbox specific known hosts file.
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Containerfile | 4 | ||||
| -rwxr-xr-x | dbx | 3 | ||||
| -rwxr-xr-x | dbx-enter | 2 | ||||
| -rwxr-xr-x | dbx-proxy | 17 | ||||
| -rw-r--r-- | ssh/config.in | 2 |
6 files changed, 26 insertions, 3 deletions
@@ -3,4 +3,5 @@ custom/extra-packages custom/post-install custom/skel/ ssh/*.config +ssh/*.known_hosts ssh/id_* diff --git a/Containerfile b/Containerfile index 24698e9..9f250dd 100644 --- a/Containerfile +++ b/Containerfile @@ -7,6 +7,7 @@ RUN touch /run/.dbxenv RUN rm /etc/apt/apt.conf.d/docker-* && \ apt-get update && \ apt-get install -y \ + locales \ openssh-server \ sudo \ tini \ @@ -14,6 +15,9 @@ RUN rm /etc/apt/apt.conf.d/docker-* && \ apt-get clean && \ rm -dr /var/lib/apt/lists/* +# Configure locale with UTF-8 support +RUN update-locale LANG=C.UTF-8 LC_ALL=C.UTF-8 + # Configure SSH server COPY ssh/id_ed25519.pub /etc/ssh/authorized_keys RUN echo "StreamLocalBindUnlink yes" >> /etc/ssh/sshd_config && \ @@ -13,6 +13,7 @@ dbx - containerized development environments USAGE: dbx create creates the devbox dbx [enter] enters the devbox + dbx proxy PORT proxies a devbox port to the host dbx start starts the devbox dbx stop stops the devbox EOF @@ -22,7 +23,7 @@ cmd="${1:-enter}" shift || true case "$#:$cmd" in - 0:create|0:enter|0:start|0:stop) + 0:create|0:enter|1:proxy|0:start|0:stop) "$root/dbx-$cmd" "$@" ;; *) @@ -8,4 +8,4 @@ root="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" machine="${DBX_MACHINE:-dbx}" "$root/dbx-start" -exec ssh -F "$root/ssh/$machine.config" "$machine" +exec ssh "$machine" -F "$root/ssh/$machine.config" diff --git a/dbx-proxy b/dbx-proxy new file mode 100755 index 0000000..67e0456 --- /dev/null +++ b/dbx-proxy @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-only + +set -euo pipefail + +if [[ $# -ne 1 ]]; then + echo "ERROR: missing port to proxy" >&2 + exit 1 +fi + +root="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" +machine="${DBX_MACHINE:-dbx}" +port="$1" + +"$root/dbx-start" +exec ssh "$machine" -F "$root/ssh/$machine.config" \ + -L "localhost:$port:localhost:$port" -N diff --git a/ssh/config.in b/ssh/config.in index 294754e..fbcbc40 100644 --- a/ssh/config.in +++ b/ssh/config.in @@ -3,4 +3,4 @@ Host $MACHINE IdentitiesOnly yes IdentityFile $ROOT/ssh/id_ed25519 StrictHostKeyChecking no - UserKnownHostsFile /dev/null + UserKnownHostsFile $ROOT/ssh/$MACHINE.known_hosts |
