Skip to content

Instantly share code, notes, and snippets.

@goyox86
Created January 5, 2015 21:12
Show Gist options
  • Save goyox86/21caa4936c6ecbee9c51 to your computer and use it in GitHub Desktop.
Save goyox86/21caa4936c6ecbee9c51 to your computer and use it in GitHub Desktop.
Dockerfile
FROM debian:jessie
MAINTAINER goyox86 <goyox86@gmail.com>
ENV LANG C.UTF-8
ENV LANGUAGE C.UTF-8
ENV LC_ALL C.UTF-8
ENV SHELL /bin/bash
ENV DEBIAN_FRONTEND noninteractive
# Utilities
RUN apt-get update && apt-get install -y wget make
# End Utilities
# Nginx
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62
RUN echo "deb http://nginx.org/packages/mainline/debian/ wheezy nginx" >> /etc/apt/sources.list
ENV NGINX_VERSION 1.7.9-1~wheezy
RUN apt-get update && apt-get install -y nginx=${NGINX_VERSION} && rm -rf /var/lib/apt/lists/*
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
VOLUME ["/var/cache/nginx"]
EXPOSE 80 443
#End Nginx
# Postgres
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r postgres && useradd -r -g postgres postgres
# grab gosu for easy step-down from root
RUN gpg --keyserver pgp.mit.edu --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* \
&& curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& apt-get purge -y --auto-remove curl
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
RUN mkdir /docker-entrypoint-initdb.d
RUN apt-key adv --keyserver pgp.mit.edu --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
ENV PG_MAJOR 9.4
ENV PG_VERSION 9.4.0-1.pgdg70+1
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
RUN apt-get update \
&& apt-get install -y postgresql-common \
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
&& apt-get install -y \
postgresql-$PG_MAJOR=$PG_VERSION \
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/run/postgresql && chown -R postgres /var/run/postgresql
ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH
ENV PGDATA /var/lib/postgresql/data
VOLUME /var/lib/postgresql/data
COPY postgres/docker-entrypoint.sh /
ENTRYPOINT ["postgres/docker-entrypoint.sh"]
EXPOSE 5432
# End Postgres
# Rubinius
ENV RBX_VERSION 2.4.1
RUN apt-get update && apt-get install -y --no-install-recommends ruby curl bzip2 make gcc libc6-dev g++ \
ruby-dev automake flex bison libedit-dev llvm-dev zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev \
libncurses5-dev locales patch \
&& mkdir /usr/src/rbx \
&& curl -sSL http://releases.rubini.us/rubinius-${RBX_VERSION}.tar.bz2 \
| tar -xjC /usr/src/rbx \
&& cd /usr/src/rbx/rubinius-${RBX_VERSION} \
&& gem install bundler \
&& bundle \
&& SHELL=/bin/bash ./configure --prefix=/usr/local/rubinius \
&& SHELL=/bin/bash rake install clean \
&& cd / && rm -rf /usr/src/rbx \
&& apt-get purge -y --auto-remove ruby ruby-dev g++ bison llvm llvm-dev zlib1g-dev libbison-dev \
&& rm -rf /var/lib/apt/lists/*
ENV GEM_HOME /usr/local/bundle
ENV PATH /usr/local/rubinius/bin:$GEM_HOME/bin:$PATH
RUN gem install bundler --no-ri --no-rdoc
RUN bundle config --global path "$GEM_HOME" && bundle config --global bin "$GEM_HOME/bin"
ENV BUNDLE_APP_CONFIG $GEM_HOME
# End Rubinius
# Spree
RUN gem install rails -v 4.1.8 --no-ri --no-rdoc
RUN gem install spree --no-ri --no-rdoc
RUN rails _4.1.8_ new store
RUN spree install store -A
RUN cd store && bundle exec rake railties:install:migrations && bundle exec rake db:migrate \
&& bundle exec rake db:seed && bundle exec rake spree_sample:load
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment