Skip to content

Instantly share code, notes, and snippets.

@toolmantim
Created April 18, 2015 09:07
Show Gist options
  • Save toolmantim/957701e82f0cc76d1d25 to your computer and use it in GitHub Desktop.
Save toolmantim/957701e82f0cc76d1d25 to your computer and use it in GitHub Desktop.
Example Docker setup for a Rails app
app:
build: .
links:
- db:db
- redis:redis
- memcache:memcache
volumes:
- ./:/app
environment:
PGHOST: db
PGUSER: postgres
REDIS_URL: redis://redis
MEMCACHE_SERVERS: memcache
BUILDKITE_PARALLEL_JOB:
BUILDKITE_PARALLEL_JOB_COUNT:
BUILDBOX_JOB_ID:
CI:
db:
image: postgres
redis:
image: redis
memcache:
image: tutum/memcached
FROM ruby:2.2.0
# Add official postgresql apt deb source
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
# Update all the things
RUN apt-get update
# Generate UTF-8 locale
RUN apt-get install -y locales
RUN dpkg-reconfigure locales && \
locale-gen C.UTF-8 && \
/usr/sbin/update-locale LANG=C.UTF-8
RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen
# Set UTF-8
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Install the postgres client
RUN apt-get install -y postgresql-client
# Install node.js (javascript runtime for Ruby)
RUN apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup | bash - && \
apt-get install -y nodejs
RUN mkdir /app
WORKDIR /app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment