Skip to content

Instantly share code, notes, and snippets.

@gravis
Last active September 22, 2015 18:43
Show Gist options
  • Save gravis/8940487 to your computer and use it in GitHub Desktop.
Save gravis/8940487 to your computer and use it in GitHub Desktop.
Docker Volume sharing
FROM docker:5000/wheezy-ruby
# install deps
RUN apt-get install -y qt4-qmake libqtwebkit-dev libcurl4-openssl-dev
RUN mkdir -p /bundle /rails
RUN apt-get install -y ssh
RUN mkdir -p /var/run/sshd
RUN mkdir -p /root/.ssh
RUN echo "Host github.com\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
RUN echo "root:docker" | chpasswd
VOLUME ["/rails", "/bundle"]
ENTRYPOINT ["/usr/sbin/sshd", "-D"]
WORKDIR /rails
EXPOSE 22
all: build
build:
docker build -rm -t docker:5000/bundle .
run:
-docker run -name bundle -v `pwd`/../..:/rails -v /bundle -d -p 22 docker:5000/bundle
stop:
docker stop bundle
clean:
docker rm -v bundle
bundle:
sshpass -p "docker" ssh root@localhost -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p `docker port bundle 22 | cut -d':' -f2` -A 'bundle install --gemfile=/rails/Gemfile --path=/bundle'
docker commit bundle docker:5000/bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment