- Builds a tiny image with:
- The utilities, compilers, interpreters, and package managers I use.
- My bash, tmux, and neovim configs.
- Git, podman, and OpenSSH
- A single admin user with passwordless sudo
- SSH login access to that user for any with any public key in
authorized_keys
- Starts a container that:
- Mounts the host user's ssh keys
- Mounts the host user's
~/projectsfolder - Publishes its SSH port on the host at
:22222
This environment lives on my homeserver and is used as a single workspace that can be accessed by my household's many clients. It offers a declarative, atomic environment that unites each of my devices into one tmux session and one set of git worktree states.
To deploy the unified workspace you will need a relatively modern x86 Linux host with:
- Sudo
- Podman
- Static network address (I recommend a DHCP entry, NetBIOS name, or local DNS entry - avoid exposing this to the internet as it mounts its host's user's private key)
On your intended host:
git clone https://github.com/TadghW/workspace-container.gitcd workspace-containergit submodule update --init --recursive(see "Customise!" if you don't want my config)- Set the
USER,USER_GIT_EMAIL, andUSER_GIT_NAMEARGs at the top ofDockerfile - Populate
authorized_keyswith the public ssh keys of the client devices you intend to access the space with - Replace the network address in
start-workspace.shandrefresh-workspace.shwith the address you intend to use - Run
build-workspace-image.shandstart-workspace.sh- (or one-shot it withrefresh-workspace.sh!)
To customise the workspace:
Dockerfileexposes the arguments:UID,GID,USER,GROUP,USER_GIT_EMAIL,USER_GIT_NAME,USER_GIT_DEFAULT_BRANCH- Make sure you have all of the packages you want on the apk install list in at the top of the
Dockerfile - Replace my
dotfilessubmodule with your own dotfiles - Remove the
ohmyposhandcatppuccin-tmuxinstall lines (unless you want them) - Replace my
.bashrcand.bash_profileinstalls with whatever shell you prefer
If you want to use the default configuration (my config):
- I recommend using Rio as your terminal emulator - it's very cross-platform and easy to configure. You can see my Rio config in
dotfiles/rio/. - Remember to find and apply a theme to your terminal emulator for maximum eye-comfort :)
- You'll be launched automatically into a
tmuxsession when you log in. This behaviour is configured indotfiles/.bashrc-auto-tmux, which is renamed to.bashrcon installation, and sourced by.bash_profilewhen you log in to the container. To use mytmuxconfig:- Prefix is
Ctrl + A Prefix + -for vertical splitPrefix + |for horizontal.Prefix + Arrow keysto resize a panePrefix +h,j,k, andlfor navigation.Prefix + xto close a panePrefix + cto create a new window- Close all panes to close a window
Prefix + nto move to the next windowPrefix + pto move to the previous windowPrefix + {NUMBER}to move to a specific windowPrefix + rreloads the config.
- Prefix is
- My text editor is
nvimwithlazy-nvim,Mason,telescope,neotree, andalpha-nvim:- Leader is
space Leader + eto open neotreeLeader + bto open neotree on open buffersLeader + tabto swap between windowsLeader + fsto search context for stringsLeader + ffto search context for files.- Otherwise, stock navigation
- Leader is
- For
nvimandohmyposh(my shell prompt fancy-ifier) to render properly you'll need to configure your terminal emulator to use an font that has been patched with many nerdy icons - I recommend looking through through nerd-fonts to find one you like. I likeJetbrainsMono. - I have no alias other than the one I use to connect to the workspace which is
workspace- avoid using this from within the workspace as it will nest.
sshdis the container entrypoint andstart-workspace.shandrefresh-workspace.shassume you want port forwarding for easy access - but you can attach withattach-to-workspace.shif you want to run locallysshdis run with flags-D -eand will pipe logs to stderr - if you run into issues accessing the workspace over SSH check the logs from the host withsudo podman logs workspace-containerstart-workspace.shandrefresh-workspace.shrw mount the host's ~/projects folder because that's where I expect to work, that's not a magic folder just my personal convention- There's a loop in
start-workspace.shandrefresh-workspace.shthat looks for id_rsa and id_ed25519 keys on the host to ro mount to the container. If you have another key type you want mounted add it to line 8 (for key in id_ed25519... rsa; do).
- Workspace currently builds its own SSH host keys at build time. This sucks: each rebuild will change the server identity which trips SSH host key warnings on clients. You can reset the expected host key by clearing your
known_hostsentry for that host, but a better approach would be the programmatic creation of dedicated persistent host key sets for the container when the user first runsstart-workspace.shandrefresh-workspace.shand mounting those host keys to the container. - Arm64 version for Apple Silicon
- Might as well expand the list of key types in
start-workspace.shandrefresh-workspace.sh