Skip to content

Instantly share code, notes, and snippets.

@mihaiparaschiv
Last active September 7, 2017 16:53
Show Gist options
  • Save mihaiparaschiv/0054dcfcc6ee4bc47deb0dfd702d1268 to your computer and use it in GitHub Desktop.
Save mihaiparaschiv/0054dcfcc6ee4bc47deb0dfd702d1268 to your computer and use it in GitHub Desktop.
Docker container with Docker, Google Cloud Console, tmux and other tools
set-option -ga update-environment ' PATH'
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Enable mouse control (clickable windows, panes, resizable panes)
# set -g mouse-select-window on
# set -g mouse-select-pane on
# set -g mouse-resize-pane on
set -g mouse on
docker build -t mihaiparaschiv/make "$@" .
FROM mihaiparaschiv/data-science-base:0.2.7
ENV MAKE_DOCKER_VERSION=1.13.0
ENV MAKE_TMUX_VERSION=2.5
USER root
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
software-properties-common \
curl \
screen \
openssh-client \
openssh-server \
tar \
# for tmux, maybe not all are needed here
libevent-dev ncurses-dev build-essential g++ gcc automake autoconf libtool pkg-config && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/tmux/tmux/releases/download/${MAKE_TMUX_VERSION}/tmux-${MAKE_TMUX_VERSION}.tar.gz && \
tar xf tmux-${MAKE_TMUX_VERSION}.tar.gz && \
rm -f tmux-${MAKE_TMUX_VERSION}.tar.gz && \
cd tmux-${MAKE_TMUX_VERSION} && \
./configure && \
make && \
make install && \
cd - && \
rm -rf /usr/local/src/tmux-* && \
mv tmux-${MAKE_TMUX_VERSION} /usr/local/src
# The script at https://get.docker.com loops through several key servers.
# If the key is not available on the server chosen here, the build will fail.
RUN apt-key adv \
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
echo "deb https://apt.dockerproject.org/repo debian-jessie main" >> \
/etc/apt/sources.list.d/docker.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
docker-engine=${MAKE_DOCKER_VERSION}-0~debian-jessie && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER $NB_USER
# Docker Compose
RUN pip install "docker-compose==1.15.*"
# Install Google Cloud Console
USER root
RUN export GCLOUD_SDK_REPO=cloud-sdk-jessie && \
echo "deb http://packages.cloud.google.com/apt $GCLOUD_SDK_REPO main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list && \
wget -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
apt-get update && \
apt-get install -y google-cloud-sdk && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER $NB_USER
USER root
RUN mkdir /g
RUN chown $NB_USER /g
USER $NB_USER
# RUN git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it && \
# ~/.bash_it/install.sh -s
COPY .tmux.conf /home/jovyan
WORKDIR /g
set -e
export MSYS_NO_PATHCONV=1
docker run -ti --rm \
-v /g:/g \
-v /var/run/docker.sock:/var/run/docker.sock \
--net host \
--name make-$(date -u +"%Y-%m-%d-%H-%M-%S") \
"$@" mihaiparaschiv/make bash
#docker run -ti --rm --name make-$(date -u +"%Y-%m-%d-%H-%M-%S") mihaiparaschiv/ubuntu bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment