Skip to content
Merged
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
19 changes: 17 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ RUN set -eux; \
ca-certificates \
curl \
xz-utils \
gnupg; \
gnupg \
zsh; \
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg; \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) stable" > /etc/apt/sources.list.d/docker.list; \
Expand All @@ -27,6 +28,19 @@ RUN set -eux; \
# Add profile hook to source Nix in shells and verify
RUN printf '. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh\n' > /etc/profile.d/nix.sh

# zsh is the login shell; SHELL is what a terminal session execs
ENV SHELL=/usr/bin/zsh
RUN set -eux; \
chsh -s /usr/bin/zsh root; \
printf "emulate sh -c 'source /etc/profile'\n" >> /etc/zsh/zprofile; \
printf '%s\n' \
'HISTFILE=~/.zsh_history' \
'HISTSIZE=10000' \
'SAVEHIST=10000' \
'setopt hist_ignore_dups inc_append_history' \
"PROMPT='%n@%m %~ %# '" \
> /root/.zshrc


# Ensure PATH includes Nix binaries for non-login shells as well
ENV PATH=/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:${PATH}
Expand All @@ -35,8 +49,9 @@ ENV PATH=/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:${PATH}

# Verify installations
RUN bash -lc '. /etc/profile.d/nix.sh && nix --version && docker --version'
RUN zsh -lc 'nix --version && docker --version'

# Default shell
# Build-time shell for RUN; the runtime default is SHELL=/usr/bin/zsh above
SHELL ["/bin/bash", "-lc"]

# Default CMD
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ Included:
- Ubuntu 24.04 base (pinned)
- Nix via Determinate Systems installer (no init/systemd; sandbox disabled)
- Docker CLI from Docker’s apt repository
- zsh as the default shell

Usage:
- Pull: `docker pull ghcr.io/agynio/devcontainer:latest`
- Run: `docker run --rm -it ghcr.io/agynio/devcontainer:latest bash`
- Run: `docker run --rm -it ghcr.io/agynio/devcontainer:latest zsh`

Notes:
- Nix is initialized via `/etc/profile.d/nix.sh` which sources the Nix environment; PATH includes Nix bins.
- zsh is root's login shell and is published as `SHELL=/usr/bin/zsh`, which is what a terminal session execs. `/root/.zshrc` carries history and prompt defaults.
- Nix is initialized via `/etc/profile.d/nix.sh` which sources the Nix environment; PATH includes Nix bins. zsh reaches it through `/etc/zsh/zprofile`, which does not source `/etc/profile` on Ubuntu by default.
- Docker CLI requires access to a running Docker daemon. For local usage, you may mount the host socket: `-v /var/run/docker.sock:/var/run/docker.sock`.
- Verify tools: `nix --version` and `docker --version`.
Loading