Add support for file editor

This commit is contained in:
marcos
2018-01-05 13:13:07 -03:00
parent f564f1fd28
commit 386bd87385
32 changed files with 621 additions and 93 deletions

View File

@@ -0,0 +1,2 @@
[url "https://"]
insteadOf = git://

73
dockerfiles/pwm/.inputrc Normal file
View File

@@ -0,0 +1,73 @@
# /etc/inputrc - global inputrc for libreadline
# See readline(3readline) and `info rluserman' for more information.
# Be 8 bit clean.
set input-meta on
set output-meta on
# To allow the use of 8bit-characters like the german umlauts, uncomment
# the line below. However this makes the meta key not work as a meta key,
# which is annoying to those which don't need to type in 8-bit characters.
# set convert-meta off
# try to enable the application keypad when it is called. Some systems
# need this to enable the arrow keys.
# set enable-keypad on
# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys
# do not bell on tab-completion
# set bell-style none
# set bell-style visible
# some defaults / modifications for the emacs mode
$if mode=emacs
# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert
# mappings for "page up" and "page down" to step to the beginning/end
# of the history
# "\e[5~": beginning-of-history
# "\e[6~": end-of-history
# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
$if term=rxvt
"\e[7~": beginning-of-line
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word
$endif
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
# "\eOH": beginning-of-line
# "\eOF": end-of-line
# for freebsd console
# "\e[H": beginning-of-line
# "\e[F": end-of-line
$endif
# faster completion
set show-all-if-ambiguous on
"\e[A": history-search-backward
"\e[B": history-search-forward

5
dockerfiles/pwm/.profile Normal file
View File

@@ -0,0 +1,5 @@
export PS1='\e[1m\e[31m[\h] \e[32m\e[34m\u@$(hostname -i)\e[35m \w\e[0m\n$ '
alias vi='vim'
export PATH=$PATH:/root/go/bin
cat /etc/motd
echo $BASHPID > /var/run/cwd

6
dockerfiles/pwm/.vimrc Normal file
View File

@@ -0,0 +1,6 @@
syntax on
set autoindent
set expandtab
set number
set shiftwidth=2
set softtabstop=2

View File

@@ -0,0 +1,44 @@
ARG VERSION=docker:stable-dind
FROM ${VERSION}
RUN apk add --no-cache git tmux vim curl bash build-base qemu-img qemu-system-x86_64
ENV GOPATH /root/go
ENV PATH $PATH:$GOPATH
# Use specific moby commit due to vendoring mismatch
ENV MOBY_COMMIT="d9d2a91780b34b92e669bbfa099f613bd9fad6bb"
RUN mkdir /root/go && apk add --no-cache go \
&& go get -u -d github.com/moby/tool/cmd/moby && (cd $GOPATH/src/github.com/moby/tool/cmd/moby && git checkout $MOBY_COMMIT && go install) \
&& go get -u github.com/linuxkit/linuxkit/src/cmd/linuxkit \
&& rm -rf /root/go/pkg && rm -rf /root/go/src && rm -rf /usr/lib/go
# Add bash completion and set bash as default shell
RUN mkdir /etc/bash_completion.d \
&& curl https://raw.githubusercontent.com/docker/cli/master/contrib/completion/bash/docker -o /etc/bash_completion.d/docker \
&& sed -i "s/ash/bash/" /etc/passwd
# Replace modprobe with a no-op to get rid of spurious warnings
# (note: we can't just symlink to /bin/true because it might be busybox)
RUN rm /sbin/modprobe && echo '#!/bin/true' >/sbin/modprobe && chmod +x /sbin/modprobe
# Install a nice vimrc file and prompt (by soulshake)
COPY ["sudo", "/usr/local/bin/"]
COPY [".vimrc", ".profile", ".inputrc", ".gitconfig", "./root/"]
COPY ["motd", "/etc/motd"]
COPY ["daemon.json", "/etc/docker/"]
# Move to our home
WORKDIR /root
# Remove IPv6 alias for localhost and start docker in the background ...
CMD cat /etc/hosts >/etc/hosts.bak && \
sed 's/^::1.*//' /etc/hosts.bak > /etc/hosts && \
mount -t securityfs none /sys/kernel/security && \
dockerd &>/docker.log & \
while true ; do /bin/bash -l; done
# ... and then put a shell in the foreground, restarting it if it exits

View File

@@ -0,0 +1,7 @@
{
"experimental": true,
"debug": true,
"log-level": "info",
"insecure-registries": ["127.0.0.1"],
"hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"]
}

8
dockerfiles/pwm/motd Normal file
View File

@@ -0,0 +1,8 @@
###############################################################
# WARNING!!!! #
# This is a sandbox environment. Using personal credentials #
# is HIGHLY! discouraged. Any consequences of doing so are #
# completely the user's responsibilites. #
# #
# The PWD team. #
###############################################################

5
dockerfiles/pwm/sudo Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# This is shim to help with the case were pasted commands from a readme assume you are not root. Since this isto be run by root, it should effectively be a dummy command that allows the parameters to pass through.
exec $@