From a73935d068fc2eecaf66ff0ed1119707a19f6a40 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Tue, 14 May 2024 11:45:46 +0800 Subject: [PATCH 1/3] feat: install zsh on unbuntu for developing --- Dockerfile | 8 +++++--- get-zsh.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100755 get-zsh.sh diff --git a/Dockerfile b/Dockerfile index 1f15cd9..f9f7b45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ ARG BUILD_FROM=public.ecr.aws/ubuntu/ubuntu:22.04 FROM ${BUILD_FROM} ENV EMQX_BUILDER_IMAGE=${BUILD_FROM} +ENV ERL_AFLAGS="-kernel shell_history enabled" ARG OTP_VERSION=26.2.3-1 ARG ELIXIR_VERSION=1.15.7 @@ -9,14 +10,15 @@ ARG FDB_VERSION=7.3.27 ARG EMQTT_BENCH_REF=0.4.17 ARG LUX_REF=lux-2.9.1 -COPY get-otp.sh get-elixir.sh get-fdb.sh get-emqtt-bench.sh get-lux.sh / +COPY get-otp.sh get-zsh.sh get-elixir.sh get-fdb.sh get-emqtt-bench.sh get-lux.sh / RUN /get-otp.sh ${OTP_VERSION} && \ /get-elixir.sh ${ELIXIR_VERSION} && \ + /get-zsh.sh && \ env FDB_VERSION=${FDB_VERSION} /get-fdb.sh && \ env EMQTT_BENCH_REF=${EMQTT_BENCH_REF} /get-emqtt-bench.sh && \ env LUX_REF=${LUX_REF} /get-lux.sh && \ - rm /get-otp.sh /get-elixir.sh /get-fdb.sh /get-emqtt-bench.sh /get-lux.sh + rm /get-otp.sh /get-zsh.sh /get-elixir.sh /get-fdb.sh /get-emqtt-bench.sh /get-lux.sh WORKDIR / -CMD [ "/bin/bash" ] +CMD [ "/bin/zsh" ] diff --git a/get-zsh.sh b/get-zsh.sh new file mode 100755 index 0000000..c55e639 --- /dev/null +++ b/get-zsh.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -euo pipefail + +URL="https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh" + +cd / +curl --silent --show-error -fkL "$URL" -o "zsh-in-docker.sh" +chmod +x zsh-in-docker.sh + +## build + + ./zsh-in-docker.sh \ + -t https://github.com/denysdovhan/spaceship-prompt \ + -a 'SPACESHIP_PROMPT_ADD_NEWLINE="false"' \ + -a 'SPACESHIP_PROMPT_SEPARATE_LINE="false"' \ + -p git \ + -p git-fast + -p https://github.com/zsh-users/zsh-autosuggestions \ + -p https://github.com/zsh-users/zsh-completions \ + -p https://github.com/zsh-users/zsh-history-substring-search \ + -p https://github.com/zsh-users/zsh-syntax-highlighting \ + -p 'history-substring-search' \ + -a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \ + -a 'bindkey "\$terminfo[kcud1]" history-substring-search-down' + + +## cleanup +cd / +rm -rf zsh-in-docker.sh + From 66a16ffbaeafcf8acf0ad446aa54dfc4921f19a1 Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Tue, 14 May 2024 15:19:18 +0800 Subject: [PATCH 2/3] chore: let the get-zsh.sh run first --- Dockerfile | 6 +++--- get-zsh.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f9f7b45..238b902 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,9 +12,9 @@ ARG LUX_REF=lux-2.9.1 COPY get-otp.sh get-zsh.sh get-elixir.sh get-fdb.sh get-emqtt-bench.sh get-lux.sh / -RUN /get-otp.sh ${OTP_VERSION} && \ - /get-elixir.sh ${ELIXIR_VERSION} && \ - /get-zsh.sh && \ +RUN /get-zsh.sh && \ + /get-otp.sh ${OTP_VERSION} && \ + /get-elixir.sh ${ELIXIR_VERSION} && \ env FDB_VERSION=${FDB_VERSION} /get-fdb.sh && \ env EMQTT_BENCH_REF=${EMQTT_BENCH_REF} /get-emqtt-bench.sh && \ env LUX_REF=${LUX_REF} /get-lux.sh && \ diff --git a/get-zsh.sh b/get-zsh.sh index c55e639..d756962 100755 --- a/get-zsh.sh +++ b/get-zsh.sh @@ -15,7 +15,7 @@ chmod +x zsh-in-docker.sh -a 'SPACESHIP_PROMPT_ADD_NEWLINE="false"' \ -a 'SPACESHIP_PROMPT_SEPARATE_LINE="false"' \ -p git \ - -p git-fast + -p git-fast \ -p https://github.com/zsh-users/zsh-autosuggestions \ -p https://github.com/zsh-users/zsh-completions \ -p https://github.com/zsh-users/zsh-history-substring-search \ From c911cdb323a042e6d54e2e1aa1e07911db9a7ce0 Mon Sep 17 00:00:00 2001 From: Ivan Dyachkov Date: Tue, 14 May 2024 09:34:05 +0200 Subject: [PATCH 3/3] fix: use our zsh-in-docker fork --- Dockerfile | 2 +- get-zsh.sh | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 238b902..15890ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ ARG LUX_REF=lux-2.9.1 COPY get-otp.sh get-zsh.sh get-elixir.sh get-fdb.sh get-emqtt-bench.sh get-lux.sh / -RUN /get-zsh.sh && \ +RUN /get-zsh.sh && \ /get-otp.sh ${OTP_VERSION} && \ /get-elixir.sh ${ELIXIR_VERSION} && \ env FDB_VERSION=${FDB_VERSION} /get-fdb.sh && \ diff --git a/get-zsh.sh b/get-zsh.sh index d756962..11ac9a4 100755 --- a/get-zsh.sh +++ b/get-zsh.sh @@ -2,15 +2,14 @@ set -euo pipefail -URL="https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh" +git clone https://github.com/emqx/zsh-in-docker.git -b V1.1.5-emqx.2 -cd / -curl --silent --show-error -fkL "$URL" -o "zsh-in-docker.sh" +cd zsh-in-docker chmod +x zsh-in-docker.sh ## build - - ./zsh-in-docker.sh \ +alternatives --list | grep python && alternatives --set python /usr/bin/python2 || true +./zsh-in-docker.sh \ -t https://github.com/denysdovhan/spaceship-prompt \ -a 'SPACESHIP_PROMPT_ADD_NEWLINE="false"' \ -a 'SPACESHIP_PROMPT_SEPARATE_LINE="false"' \ @@ -23,9 +22,8 @@ chmod +x zsh-in-docker.sh -p 'history-substring-search' \ -a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \ -a 'bindkey "\$terminfo[kcud1]" history-substring-search-down' - +alternatives --list | grep python && alternatives --set python /usr/bin/python3 || true ## cleanup cd / -rm -rf zsh-in-docker.sh - +rm -rf zsh-in-docker