Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
BananaWanted authored and BananaWanted committed Nov 22, 2017
1 parent 2e2b663 commit 09914a2
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 166 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
shared/*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "solarized"]
path = solarized
url = [email protected]:altercation/solarized.git
39 changes: 19 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:16.04
FROM ubuntu:xenial

ARG DEBIAN_FRONTEND=noninteractive
ARG INSTALL_PACKAGES="\
Expand All @@ -16,8 +16,6 @@ ARG INSTALL_PACKAGES="\
openssh-server \
iputils-ping \
libnet-ifconfig-wrapper-perl \
linux-image-extra-4.8.0-36-generic \
linux-image-extra-virtual \
apt-transport-https \
ca-certificates \
software-properties-common \
Expand All @@ -32,28 +30,29 @@ ARG INSTALL_PACKAGES="\
ARG TERM=xterm-256color
VOLUME /shared
WORKDIR /root
EXPOSE 22 80 8080 1080 8000
EXPOSE 22

COPY sources.list /etc/apt/sources.list
RUN apt-get update && \
apt-get install -y --no-install-recommends apt-utils && \
apt-get install -y $INSTALL_PACKAGES && \
apt-get upgrade -y && \
curl -fsSL https://yum.dockerproject.org/gpg | apt-key add - && \
add-apt-repository \
"deb https://apt.dockerproject.org/repo/ \
ubuntu-$(lsb_release -cs) \
main" && \
apt-get update && \
apt-get -y install docker-engine && \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"; \
RUN apt-get update \
&& apt-get install -y --no-install-recommends apt-utils \
&& apt-get install -y $INSTALL_PACKAGES
RUN apt-get update \
&& apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \
&& add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable" \
&& apt-get update \
&& apt-get install docker-ce
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"; \
chsh -s /bin/zsh

COPY zshrc /root/.zshrc

COPY dircolors /root/.dircolors
RUN dircolors -b ~/.dircolors >> ~/.zshrc
RUN dircolors -b /root/.dircolors > /root/.dircolors_source

COPY zshrc /root/.zshrc
COPY robbyrussell.zsh-theme /root/.oh-my-zsh/themes/robbyrussell.zsh-theme
COPY dubuntu.zsh-theme /root/.oh-my-zsh/custom/dubuntu.zsh-theme
COPY authorized_keys /root/.ssh/authorized_keys
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY entrypoint.sh /entrypoint.sh
Expand Down
3 changes: 2 additions & 1 deletion authorized_keys
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWyZIejjXBX21Ujxq46X2OAU22wDNAUiVPAyNsiRWt/5J1klsLJui5b3Zpaxs+lSimWJCG0smi/BpytusR3fgagprRy4ymQRHWJLmcZJ1oo2D6PZ/HggXis0Tew8ERfnUgyNs/yzUteSrYXHzoyFFg76MZLwBz9J/q6zT43mtgXTjcfOFfKfHb4QgWpS63T3ExtnWw13W4kuXTElRwj0EF5DOyWqEe78VTuSDlxCQsVpfDdrOk4vk6iEH8qw4QaQphJwcjUpsUo+4IOIKghsEIZplJiCfkV9WInK+HqrX/a1vacrH9my/FsGk0Is9I1Oy0KYbL0IQ72EX6SQjWFxPV
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCmPWmJIlT1HXgO5lvws58x8VSe8f5ZdZIoFe9puaj/trSbs/3O2TMOCePbA+vcHTgytOc0xJ+2k96rxkXBSSsXUQLVHsOOA4167eyh8WK9xZmmuiE/mFGxvMHzR4+2ZTIPdJufQR8uyKzTvk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chC9T9/fLb6iyNZpPT3s/gdePDhP2i0l8UyAFmc+yroUiXcqkq5JBCRJFDuQwLrO71tNn4fIl7m8gu/JciqI4JZOU4Uppj2t/WMHmk51llOX5x2bMqWFLPXefSNtuUNraBFEcYGEBG7w7zGiE8C9QOVxJCfC0K0CeXMDqMMiwTW7ujjQ==
1 change: 0 additions & 1 deletion run.sh → build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env bash

docker-compose build --force-rm
docker-compose up -d
10 changes: 0 additions & 10 deletions docker-compose-build.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ version: "3"
services:
dubuntu:
build: .
image: dubuntu
image: 4oranges/dubuntu
container_name: dubuntu
ports:
- 127.0.0.1:22:22
volumes:
- ./shared:/shared
privileged: true
privileged: true
4 changes: 2 additions & 2 deletions robbyrussell.zsh-theme → dubuntu.zsh-theme
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT='%{$FG[088]%}[Dubuntu]%{$reset_color%} ${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
PROMPT='%{$FG[012]%}[Dubuntu]%{$reset_color%}${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'

ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
14 changes: 13 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#!/bin/bash

mkdir /var/run/sshd
/usr/bin/supervisord
mkdir -p /shared

if [ -f /shared/sources.list ]; then ln -sf /shared/sources.list /etc/apt/sources.list; fi
if [ -f /shared/resolv.conf ]; then ln -sf /shared/resolv.conf /etc/resolv.conf; fi
if [ -f /shared/authorized_keys ]; then
mkdir -p /root/.ssh
ln -sf /shared/authorized_keys /root/.ssh/authorized_keys
chmod 644 /root/.ssh/authorized_keys
fi
if [ -f /shared/dircolors ]; then dircolors -b /shared/dircolors > /root/.dircolors_source; fi


/usr/bin/supervisord
13 changes: 12 additions & 1 deletion shared/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Shared Content Directory

This folder is shared among vms, and mounted at `/shared`.
This folder is shared among vms, and mount at `/shared`.

## Additional controls to the VM
Put a file with specific name in this directory to override corresponding settings in VM.
All file overriding is in symbol linking.

Available config files:
- `sources.list`: override `/etc/apt/sources.list` in VM.
- `resolv.conf`: override `/etc/resolv.conf` in VM.
- `authorized_keys`: override `/root/.ssh/authorized_keys` in VM.
- `dircolors`: override color mapping of the inside console.
- `profile`: addition `zsh` startup source script.
1 change: 1 addition & 0 deletions solarized
Submodule solarized added at e40cd4
46 changes: 0 additions & 46 deletions sources.list

This file was deleted.

3 changes: 3 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker-compose up -d
112 changes: 30 additions & 82 deletions zshrc
Original file line number Diff line number Diff line change
@@ -1,94 +1,39 @@
#!/usr/bin/env zsh
# load bashrc
alias shopt="echo unsupported bash command: shopt "
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH=/root/.oh-my-zsh

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git docker)

export EDITOR=vim
ZSH_THEME="dubuntu"
plugins=(git git_remote_branch encode64 sudo docker docker-compose command-not-found debian systemd common-aliases dirhistory jsontools pip python screen urltools)
source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias ls='ls -pGC'
alias dc='docker-compose'
alias count-cpp="git ls-files | grep -E '(\.cpp)|(\.h)$' | xargs wc -l"
alias count-c="git ls-files | grep -E '(\.c)|(\.h)$' | xargs wc -l"
alias ipt='iptables'
alias drd='docker rmi $(docker images -q -f dangling=true)'
ipl() {
local stack=""
iptables -L --line-numbers -nv $@ | while read line; do
if [ ! "$(echo $line | awk '{ print $1 }')" = "Chain" ]; then
stack="$stack\n$line"
else
if [ -n $stack ]; then
print $stack | column -t
stack=""
fi
echo $line
fi
done
if [ -n $stack ]; then
print $stack # | column -t
fi
}

# Fix numeric keypad
# 0 . Enter
Expand All @@ -112,3 +57,6 @@ bindkey -s "^[Ol" "+"
bindkey -s "^[Om" "-"
bindkey -s "^[Oj" "*"
bindkey -s "^[Oo" "/"

source /root/.dircolors_source
if [ -f /shared/profile ]; then source /shared/profile; fi

0 comments on commit 09914a2

Please sign in to comment.