Skip to content

Commit

Permalink
Changed: Made docker images much smaller.
Browse files Browse the repository at this point in the history
  • Loading branch information
delner committed Dec 29, 2015
1 parent 239b1a7 commit 86230c9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 26 deletions.
41 changes: 23 additions & 18 deletions nginx-unicorn-rails/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
FROM delner/ruby:2.3.0
MAINTAINER David Elner <[email protected]>

RUN apt-get update
# Install dependencies
RUN apt-get update && \
apt-get install -qq -y nodejs software-properties-common

# Install nodejs
RUN apt-get install -qq -y nodejs
# Install Nginx.
RUN add-apt-repository -y ppa:nginx/stable && apt-get update && \
apt-get install -qq -y nginx=1.8.0-1+trusty1 && \

# Intall software-properties-common for add-apt-repository
RUN apt-get install -qq -y software-properties-common
# Cleanup
apt-get clean && \
cd /var/lib/apt/lists && rm -fr *Release* *Sources* *Packages* && \
truncate -s 0 /var/log/*log

# Install Nginx.
RUN add-apt-repository -y ppa:nginx/stable && apt-get update
RUN apt-get install -qq -y nginx=1.8.0-1+trusty1
# Turn off nginx and set owner
RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf
RUN chown -R www-data:www-data /var/lib/nginx

# Add default nginx config
ADD nginx-sites.conf /etc/nginx/sites-enabled/default

# Install foreman
RUN gem install foreman

# Install the latest postgresql lib for pg gem
# Install DB libs
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --force-yes libpq-dev
apt-get install -y --force-yes libpq-dev libmysqlclient-dev && \

## Install MySQL(for mysql, mysql2 gem)
RUN apt-get install -qq -y libmysqlclient-dev
# Cleanup
apt-get clean && \
cd /var/lib/apt/lists && rm -fr *Release* *Sources* *Packages* && \
truncate -s 0 /var/log/*log

# Install Rails App
WORKDIR /app
ONBUILD ADD Gemfile /app/Gemfile
ONBUILD ADD Gemfile.lock /app/Gemfile.lock
ONBUILD RUN bundle install
# Defer installation of gems to run time
# So we can take advantage of gem data volume
# ONBUILD ADD Gemfile /app/Gemfile
# ONBUILD ADD Gemfile.lock /app/Gemfile.lock
# ONBUILD RUN bundle install
ONBUILD ADD . /app

# Add default unicorn config
Expand Down
14 changes: 9 additions & 5 deletions ruby/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
FROM delner/ubuntu-core:14.04.3
MAINTAINER David Elner <[email protected]>

RUN apt-get update

# Install ruby dependencies
RUN apt-get install -y wget curl \
RUN apt-get update && \
apt-get install -y wget curl \
build-essential git git-core \
zlib1g-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev
zlib1g-dev libssl-dev libreadline-dev libyaml-dev \
libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev && \

# Cleanup
apt-get clean && \
cd /var/lib/apt/lists && rm -fr *Release* *Sources* *Packages* && \
truncate -s 0 /var/log/*log

RUN apt-get update

# Install Ruby 2.3
RUN cd /tmp &&\
Expand Down
10 changes: 7 additions & 3 deletions ubuntu-core/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
FROM ubuntu:14.04.3
MAINTAINER David Elner <[email protected]>

RUN apt-get update

# Install core utilities
RUN apt-get install -y vim screen lsof tcpdump iptraf
RUN apt-get update -q && \
apt-get install -qy vim screen lsof tcpdump iptraf --no-install-recommends &&\

# Then cleanup
apt-get clean && \
cd /var/lib/apt/lists && rm -fr *Release* *Sources* *Packages* && \
truncate -s 0 /var/log/*log

0 comments on commit 86230c9

Please sign in to comment.