|
| 1 | +FROM node:22-slim |
| 2 | + |
| 3 | +ENV DEBIAN_FRONTEND noninteractive |
| 4 | + |
| 5 | +# Install dependencies |
| 6 | +RUN --mount=type=cache,target=/var/cache/apt/install \ |
| 7 | + apt-get update \ |
| 8 | + && apt-get -y install --no-install-recommends \ |
| 9 | + ca-certificates curl git gnupg2 locales shellcheck wget zsh |
| 10 | + |
| 11 | +# Set locales |
| 12 | +RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment \ |
| 13 | + && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ |
| 14 | + && echo "LANG=en_US.UTF-8" > /etc/locale.conf \ |
| 15 | + && locale-gen en_US.UTF-8 |
| 16 | + |
| 17 | +# Install Yarn |
| 18 | +RUN --mount=type=cache,target=/var/cache/yarn \ |
| 19 | + npm install -g corepack \ |
| 20 | + && corepack enable \ |
| 21 | + && yarn set version stable |
| 22 | + |
| 23 | +# Enable shell history between sessions |
| 24 | +RUN --mount=type=cache,target=/var/cache/commandhistory \ |
| 25 | + mkdir /commandhistory \ |
| 26 | + && touch /commandhistory/.zsh_history \ |
| 27 | + && chown -R node /commandhistory |
| 28 | + |
| 29 | +# Set Zsh as default shell |
| 30 | +RUN usermod --shell /bin/zsh node |
| 31 | + |
| 32 | +USER node |
| 33 | + |
| 34 | +# Install and configure zsh |
| 35 | +RUN --mount=type=cache,target=/var/cache/oh-my-zsh \ |
| 36 | + sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.0/zsh-in-docker.sh)" -- \ |
| 37 | + -x \ |
| 38 | + -t robbyrussell \ |
| 39 | + -p debian \ |
| 40 | + -p git \ |
| 41 | + -p node \ |
| 42 | + -p yarn \ |
| 43 | + -a "zstyle ':omz:update' mode auto" \ |
| 44 | + -a "export PROMPT_COMMAND='history -a'" \ |
| 45 | + -a "export HISTFILE=/commandhistory/.zsh_history" \ |
| 46 | + -a "function gi() { curl -sLw \"\\\n\" https://www.toptal.com/developers/gitignore/api/\$@ ;}" |
0 commit comments