nushell/docker/Dockerfile
Justin Ma 257290acc2
Add a dockerfile example based on debian bullseye-slim (#5176)
* feat: add nu dockerfile, based on debian bullseye

* use aria2 instead of wget for bad network

* some small fix
2022-04-13 14:48:54 +03:00

31 lines
1.6 KiB
Docker

# Git: git version 2.30.2
# /etc/os-release: Debian: Debian GNU/Linux 11 (bullseye)
# Kernel: Linux ec73d87a5aab 5.10.104-linuxkit #1 SMP Wed Mar 9 19:05:23 UTC 2022 x86_64 GNU/Linux
# Build cmd: docker build --no-cache . -t nushell-0.61
# Other tags: nushell/debian-nu.0.61, nushell
FROM debian:bullseye-slim
LABEL maintainer=nushell
RUN apt update \
&& apt upgrade -y \
# Need ca-certificates to make `curl -s` work
&& apt install -y --no-install-recommends --no-install-suggests ca-certificates aria2 curl git unzip \
# Make /bin/sh symlink to bash instead of dash:
&& echo "dash dash/sh boolean false" | debconf-set-selections \
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash \
&& cd /lib; curl -s https://api.github.com/repos/nushell/nushell/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep linux | aria2c -i - \
&& tar xvf nu_0*.tar.gz \
&& cd nu_0* && cp -aR nushell*/** /usr/local/bin/ \
# Setup default config file for nushell
&& mkdir -p /root/.config/nushell && cd /root/.config/nushell \
&& aria2c https://raw.githubusercontent.com/nushell/nushell/main/docs/sample_config/default_env.nu -o env.nu \
&& aria2c https://raw.githubusercontent.com/nushell/nushell/main/docs/sample_config/default_config.nu -o config.nu \
# Do some cleanup work
&& cd /lib; rm -rf nu_0* nu-latest.tar.gz \
&& rm -rf /var/lib/apt/lists/* && apt autoremove -y \
&& echo '/usr/local/bin/nu' >> /etc/shells \
# Add an nushell user and create home dir
&& useradd -m -s /usr/local/bin/nu nushell
CMD [ "nu" ]