-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merging docker c8y bash and zsh images to one called c8y-shell which …
…includes bash, zsh and fish
- Loading branch information
1 parent
d27729e
commit c06bb33
Showing
8 changed files
with
93 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
FROM mcr.microsoft.com/powershell:7.1.1-ubuntu-18.04 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y vim \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
&& apt-get install -y vim git \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& git clone https://github.com/reubenmiller/go-c8y-cli-addons.git /root/.go-c8y-cli | ||
|
||
ENV C8Y_HOME=/root/.go-c8y-cli | ||
ENV C8Y_SESSION_HOME=/sessions | ||
ENV C8Y_INSTALL_OPTIONS="-AllowPrerelease" | ||
VOLUME [ "/sessions" ] | ||
|
||
COPY profile.ps1 /root/.config/powershell/Microsoft.PowerShell_profile.ps1 | ||
|
||
RUN pwsh -c "Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted; " \ | ||
&& pwsh -c "Install-Module PSc8y -Repository PSGallery -AllowClobber -Force" | ||
&& pwsh -c "Install-Module PSc8y -Repository PSGallery -AllowClobber $C8Y_INSTALL_OPTIONS -Force" | ||
|
||
ENTRYPOINT [ "pwsh", "-NoExit", "-c", "Import-Module PSc8y" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
FROM alpine:3.11 | ||
|
||
ARG USERNAME=c8yuser | ||
ARG C8Y_VERSION=1.3.0 | ||
|
||
RUN apk update \ | ||
&& apk add curl unzip bash bash-completion zsh fish git vim jq \ | ||
&& adduser -S $USERNAME \ | ||
&& mkdir -p /sessions \ | ||
&& chown -R $USERNAME /sessions \ | ||
&& git clone https://github.com/reubenmiller/go-c8y-cli-addons.git /home/$USERNAME/.go-c8y-cli | ||
|
||
WORKDIR /home/$USERNAME | ||
|
||
USER $USERNAME | ||
RUN sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" -s --batch | ||
USER root | ||
|
||
# add binary to path | ||
ENV PATH=${PATH}:/home/$USERNAME/bin | ||
ENV C8Y_SESSION_HOME=/sessions | ||
COPY ./c8y.linux /home/$USERNAME/bin/c8y | ||
|
||
|
||
# install plugins | ||
RUN echo "source /home/$USERNAME/.go-c8y-cli/shell/c8y.plugin.sh" >> /home/$USERNAME/.bashrc \ | ||
# && echo "export C8Y_SESSION_HOME=/sessions" >> /home/$USERNAME/.bashrc \ | ||
&& bash -c "c8y version" \ | ||
# | ||
# zsh | ||
&& mkdir -p /home/$USERNAME/.oh-my-zsh/custom/plugins/c8y/ \ | ||
&& cp /home/$USERNAME/.go-c8y-cli/shell/c8y.plugin.zsh /home/$USERNAME/.oh-my-zsh/custom/plugins/c8y/ \ | ||
&& sed -iE 's/^plugins=(\(.*\))/plugins=(\1 c8y)/' /home/$USERNAME/.zshrc \ | ||
# | ||
# Create completions before zsh runs otherwise | ||
# it will not automatically load the completions until the user | ||
# runs 'source ~/.zshrc' | ||
&& c8y completion zsh > /home/$USERNAME/.oh-my-zsh/custom/plugins/c8y/_c8y \ | ||
# && echo "export C8Y_SESSION_HOME=/sessions" >> /home/$USERNAME/.zshrc \ | ||
# | ||
# fish | ||
&& mkdir -p /home/$USERNAME/.config/fish \ | ||
&& echo "source /home/$USERNAME/.go-c8y-cli/shell/c8y.plugin.fish" >> /home/$USERNAME/.config/fish/config.fish \ | ||
# && echo "set -gx C8Y_SESSION_HOME /sessions" >> /home/$USERNAME/.config/fish/config.fish \ | ||
&& fish -c "c8y version" | ||
|
||
|
||
# Working settings | ||
RUN chown -R $USERNAME /home/$USERNAME | ||
|
||
# Prevent zsh plugins from affecting completions | ||
# https://github.com/ohmyzsh/ohmyzsh/issues/1282 | ||
# https://stackoverflow.com/questions/11916064/zsh-tab-completion-duplicating-command-name | ||
ENV LANG=C.UTF-8 | ||
ENV LC_ALL=C.UTF-8 | ||
|
||
USER $USERNAME | ||
VOLUME [ "/sessions" ] | ||
|
||
ENTRYPOINT [ "/bin/zsh" ] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters