From 94a0787a93b01d196a945bc5d76501de672fe21f Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Mon, 25 Nov 2019 18:04:15 -0600 Subject: [PATCH 1/5] docker: add example Dockerfile Related #2774 --- docker/Dockerfile | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..f8e7d411b9 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,57 @@ +FROM python:3.7 + +# Use UTF-8 as the default locale +ENV LANG=C.UTF-8 + +# Better movement with [Ctrl + →] and [Ctrl + ←] +ENV INPUTRC=/etc/inputrc + +RUN set -ex \ + && echo '"\e[1;5C": forward-word' >> /etc/inputrc \ + && echo '"\e[1;5D": backward-word' >> /etc/inputrc + +# Set working directory. +# Mount your project under the same path. +WORKDIR /usr/src + +# Install useful programs +RUN apt-get update -y && apt-get install -y \ + zsh \ + less \ + git + +# Set Zsh as the default shell +SHELL ["/usr/bin/zsh", "-c"] + +# Install DVC with your specified files +RUN pip install "dvc[all]" + +# Enable autocompletion scripts for DVC +RUN wget \ + -O /usr/local/share/zsh/site-functions/_dvc \ + https://raw.githubusercontent.com/iterative/dvc/master/scripts/completion/dvc.zsh + +# Add a user to run DVC +ARG USER_ID=1000 +RUN useradd --create-home -u ${USER_ID} dvc +USER dvc + +# Load and rice the completion menu with `zstyle`: +# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fzutil-Module +RUN echo "autoload -U compinit && compinit" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*:*:*:*:*' menu select" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*:matches' group 'yes'" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*:options' description 'yes'" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*:options' auto-description '%d'" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*:corrections' format ' %F{green}-- %d (errors: %e) --%f'" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f'" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f'" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*:default' list-prompt '%S%M matches%s'" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*' format ' %F{yellow}-- %d --%f'" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*' group-name ''" >> $HOME/.zshrc \ + && echo "zstyle ':completion:*' verbose yes" >> $HOME/.zshrc + +CMD ["zsh"] + +# vim: ft=dockerfile From cd3054780294a4934267e32be8d7e033a56e2f6b Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Mon, 25 Nov 2019 18:28:34 -0600 Subject: [PATCH 2/5] docker: remove vim specific auto-setting comment --- docker/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f8e7d411b9..5f393abe8c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -53,5 +53,3 @@ RUN echo "autoload -U compinit && compinit" >> $HOME/.zshrc \ && echo "zstyle ':completion:*' verbose yes" >> $HOME/.zshrc CMD ["zsh"] - -# vim: ft=dockerfile From 0939985932d0c59058b8034cfcedc47677060e1f Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Mon, 25 Nov 2019 21:17:13 -0600 Subject: [PATCH 3/5] docker: use bash instead of zsh --- docker/Dockerfile | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 5f393abe8c..e9a9646a6f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,40 +16,18 @@ WORKDIR /usr/src # Install useful programs RUN apt-get update -y && apt-get install -y \ - zsh \ less \ git -# Set Zsh as the default shell -SHELL ["/usr/bin/zsh", "-c"] - # Install DVC with your specified files RUN pip install "dvc[all]" # Enable autocompletion scripts for DVC RUN wget \ - -O /usr/local/share/zsh/site-functions/_dvc \ - https://raw.githubusercontent.com/iterative/dvc/master/scripts/completion/dvc.zsh + -O /etc/bash_completion.d/dvc \ + https://raw.githubusercontent.com/iterative/dvc/master/scripts/completion/dvc.bash # Add a user to run DVC ARG USER_ID=1000 RUN useradd --create-home -u ${USER_ID} dvc USER dvc - -# Load and rice the completion menu with `zstyle`: -# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fzutil-Module -RUN echo "autoload -U compinit && compinit" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*:*:*:*:*' menu select" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*:matches' group 'yes'" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*:options' description 'yes'" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*:options' auto-description '%d'" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*:corrections' format ' %F{green}-- %d (errors: %e) --%f'" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f'" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f'" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*:default' list-prompt '%S%M matches%s'" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*' format ' %F{yellow}-- %d --%f'" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*' group-name ''" >> $HOME/.zshrc \ - && echo "zstyle ':completion:*' verbose yes" >> $HOME/.zshrc - -CMD ["zsh"] From c1dab89cd74c1c6aab486b4e0e3ad06099eff3c6 Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Mon, 25 Nov 2019 21:17:47 -0600 Subject: [PATCH 4/5] docker: remove LANG, already set by base image --- docker/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index e9a9646a6f..e5911a60bd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,8 +1,5 @@ FROM python:3.7 -# Use UTF-8 as the default locale -ENV LANG=C.UTF-8 - # Better movement with [Ctrl + →] and [Ctrl + ←] ENV INPUTRC=/etc/inputrc From 898e0ac5c32eb453b4368a7d9357787331ab90b3 Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Mon, 25 Nov 2019 21:20:50 -0600 Subject: [PATCH 5/5] docker: better phrasing --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index e5911a60bd..1815215b07 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,7 +16,7 @@ RUN apt-get update -y && apt-get install -y \ less \ git -# Install DVC with your specified files +# Install DVC, supporting all remotes RUN pip install "dvc[all]" # Enable autocompletion scripts for DVC