All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bash.Dockerfile.mustache Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
FROM alpine:3.12.0

RUN apk add --update --no-cache curl ca-certificates bash bash-completion zsh curl git vim ncurses util-linux

ADD {{x-codegen-script-name}} /usr/bin/{{x-codegen-script-name}}
ADD _{{x-codegen-script-name}} /usr/local/share/zsh/site-functions/_{{x-codegen-script-name}}
ADD {{x-codegen-script-name}}.bash-completion /etc/bash-completion.d/{{x-codegen-script-name}}
RUN chmod 755 /usr/bin/{{x-codegen-script-name}}

#
# Install oh-my-zsh
#
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" || true

#
# Enable bash completion
#
RUN echo '\n\
. /etc/bash_completion\n\
source /etc/bash-completion.d/{{x-codegen-script-name}}\n\
' >> ~/.bashrc

#
# Setup prompt
#
RUN echo 'export PS1="[{{appName}}] \$ "' >> ~/.bashrc
RUN echo 'export PROMPT="[{{appName}}] \$ "' >> ~/.zshrc

#
# Setup a welcome message with basic instruction
#
RUN echo -e 'echo "\
\n\
This Docker provides preconfigured environment for running the command\n\
line REST client for $(tput setaf 6){{appName}}$(tput sgr0).\n\
\n\
For convenience, you can export the following environment variables:\n\
\n\
{{#x-codegen-host-env}}$(tput setaf 3){{x-codegen-host-env}}$(tput sgr0) - server URL, e.g. https://example.com:8080\n\{{/x-codegen-host-env}}
{{#hasAuthMethods}}
{{#authMethods}}
{{#isBasicBasic}}
{{#x-codegen-basicauth-env}}$(tput setaf 3){{x-codegen-basicauth-env}}$(tput sgr0) - basic authentication credentials, e.g.: "username:password"\n\{{/x-codegen-basicauth-env}}
{{/isBasicBasic}}
{{#isApiKey}}
{{#x-codegen-apikey-env}}$(tput setaf 3){{x-codegen-apikey-env}}$(tput sgr0) - access token, e.g. "ASDASHJDG63456asdASSD"\n\{{/x-codegen-apikey-env}}
{{/isApiKey}}
{{/authMethods}}
{{/hasAuthMethods}}
\n\
$(tput setaf 7)Basic usage:$(tput sgr0)\n\
\n\
$(tput setaf 3)Print the list of operations available on the service$(tput sgr0)\n\
$ {{x-codegen-script-name}} -h\n\
\n\
$(tput setaf 3)Print the service description$(tput sgr0)\n\
$ {{x-codegen-script-name}} --about\n\
\n\
$(tput setaf 3)Print detailed information about specific operation$(tput sgr0)\n\
$ {{x-codegen-script-name}}  -h\n\
\n\
By default you are logged into Zsh with full autocompletion for your REST API,\n\
but you can switch to Bash, where basic autocompletion is also supported.\n\
\n\
"\
' | tee -a ~/.bashrc ~/.zshrc

#
# Poormans chsh & cleanup to make image as compact as possible
#

RUN sed -i 's/root:x:0:0:root:\/root:\/bin\/ash/root:x:0:0:root:\/root:\/bin\/zsh/' /etc/passwd
RUN apk del git vim && rm -f /var/cache/apk/*

ENTRYPOINT ["/bin/zsh"]




© 2015 - 2024 Weber Informatics LLC | Privacy Policy