Skip to content

Commit

Permalink
Merge pull request #41 from tsuru/clean_images
Browse files Browse the repository at this point in the history
Update Dockerfiles to remove apt cache
  • Loading branch information
guilhermebr authored Jul 25, 2017
2 parents 596826f + 64ac196 commit a615b69
Show file tree
Hide file tree
Showing 31 changed files with 133 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: required
env:
global:
- PLATFORMS="buildpack cordova elixir go java lua nodejs perl php play pypy python python3 ruby static"
- PLATFORMS="buildpack cordova elixir go java lua nodejs perl php play pypy python ruby static"
before_script:
- sudo apt-get install parallel
script:
Expand Down
17 changes: 10 additions & 7 deletions buildpack/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
FROM progrium/buildstep
RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install curl sudo -y --force-yes
RUN curl -sLo base-platform.tar.gz https://github.com/tsuru/base-platform/tarball/master
RUN mkdir -p /var/lib/tsuru/base
RUN tar -xvf base-platform.tar.gz -C /var/lib/tsuru/base --strip 1
RUN rm base-platform.tar.gz
RUN mkdir -p /var/lib/tsuru/buildpack
ADD . /var/lib/tsuru/buildpack
RUN cp /var/lib/tsuru/buildpack/deploy /var/lib/tsuru
RUN /var/lib/tsuru/buildpack/install
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
sudo \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sLo base-platform.tar.gz https://github.com/tsuru/base-platform/tarball/master; \
tar -xvf base-platform.tar.gz -C /var/lib/tsuru/base --strip 1; \
rm -rf base-platform.tar.gz
RUN set -ex; \
/var/lib/tsuru/buildpack/install; \
rm -rf /var/lib/apt/lists/*
5 changes: 2 additions & 3 deletions buildpack/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
# license that can be found in the LICENSE file.

SOURCE_DIR=/var/lib/tsuru

source ${SOURCE_DIR}/base/deploy
echo "BUILDPACK: $BUILDPACK_URL"

source ${SOURCE_DIR}/base/rc/config

echo "BUILDPACK: $BUILDPACK_URL"

cd $CURRENT_DIR
sudo /bin/sh -c "rm -rf /app && mkdir /app && cp -a . /app"
sudo -E ${SOURCE_DIR}/buildpack/build
Expand Down
4 changes: 3 additions & 1 deletion cordova/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
FROM tsuru/base-platform
ADD . /var/lib/tsuru/cordova
RUN cp /var/lib/tsuru/base/deploy /var/lib/tsuru
RUN /var/lib/tsuru/cordova/install
RUN set -ex; \
/var/lib/tsuru/cordova/install; \
rm -rf /var/lib/apt/lists/*
2 changes: 1 addition & 1 deletion cordova/install
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SOURCE_DIR=/var/lib/tsuru
source ${SOURCE_DIR}/base/rc/config

apt-get update
apt-get install nginx -y
apt-get install -y --no-install-recommends nginx

rm -rf /var/log/nginx /var/lib/nginx
mkdir -p /var/log/nginx /var/lib/nginx
Expand Down
4 changes: 3 additions & 1 deletion elixir/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
FROM tsuru/base-platform
ADD . /var/lib/tsuru/elixir
RUN cp /var/lib/tsuru/elixir/deploy /var/lib/tsuru
RUN /var/lib/tsuru/elixir/install
RUN set -ex; \
/var/lib/tsuru/elixir/install; \
rm -rf /var/lib/apt/lists/*
3 changes: 1 addition & 2 deletions elixir/install
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
curl -LO http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && dpkg -i erlang-solutions_1.0_all.deb

apt-get update
apt-get install -y esl-erlang
apt-get install -y elixir
apt-get install -y --no-install-recommends esl-erlang elixir
8 changes: 2 additions & 6 deletions go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@ FROM tsuru/base-platform
ADD . /var/lib/tsuru/go
RUN cp /var/lib/tsuru/go/deploy /var/lib/tsuru
RUN set -ex; \
apt-get update && \
apt-get install -y bzr mercurial git && \
/var/lib/tsuru/go/install && \
rm -rf /var/lib/apt/lists/* && \
apt-get autoremove -y && \
apt-get clean
/var/lib/tsuru/go/install; \
rm -rf /var/lib/apt/lists/*
7 changes: 6 additions & 1 deletion go/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
# license that can be found in the LICENSE file.

SOURCE_DIR=/var/lib/tsuru

source ${SOURCE_DIR}/base/rc/config

apt-get update
apt-get install -y --no-install-recommends \
bzr \
mercurial \
git

curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme -o /usr/bin/gimme
chmod +x /usr/bin/gimme

Expand Down
4 changes: 3 additions & 1 deletion java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
FROM tsuru/base-platform
ADD . /var/lib/tsuru/java
RUN cp /var/lib/tsuru/base/deploy /var/lib/tsuru
RUN /var/lib/tsuru/java/install
RUN set -ex; \
/var/lib/tsuru/java/install; \
rm -rf /var/lib/apt/lists/*
6 changes: 4 additions & 2 deletions java/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
# license that can be found in the LICENSE file.

SOURCE_DIR=/var/lib/tsuru

source ${SOURCE_DIR}/base/rc/config

apt-get update
apt-get install -y openjdk-7-jdk maven tomcat7
apt-get install -y --no-install-recommends \
openjdk-7-jdk \
maven \
tomcat7

cp $SOURCE_DIR/java/Procfile $SOURCE_DIR/default/Procfile

Expand Down
10 changes: 6 additions & 4 deletions lua/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

FROM tsuru/base-platform
ADD . /var/lib/tsuru/lua
RUN cp /var/lib/tsuru/lua/deploy /var/lib/tsuru
RUN /var/lib/tsuru/lua/install
FROM tsuru/base-platform
ADD . /var/lib/tsuru/lua
RUN cp /var/lib/tsuru/lua/deploy /var/lib/tsuru
RUN set -ex; \
/var/lib/tsuru/lua/install; \
rm -rf /var/lib/apt/lists/*
28 changes: 17 additions & 11 deletions lua/install
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@
SOURCE_DIR=/var/lib/tsuru
source ${SOURCE_DIR}/base/rc/config

apt-get update - && \
apt-get install -y make gcc build-essential libreadline6 libreadline6-dev --no-install-recommends
apt-get update
apt-get install -y --no-install-recommends \
make \
gcc \
build-essential \
libreadline6 \
libreadline6-dev

curl -R -O http://www.lua.org/ftp/lua-5.3.3.tar.gz && \
tar zxf lua-5.3.3.tar.gz && \
cd lua-5.3.3 && \
make linux test && \
mv ./src/lua /usr/bin/lua && \
mv ./src/luac /usr/bin/luac && \
rm /lua-5.3.3.tar.gz && \
rm -rf /lua-5.3.3
curl -R -O http://www.lua.org/ftp/lua-5.3.3.tar.gz
tar zxf lua-5.3.3.tar.gz
cd lua-5.3.3
make linux test
mv ./src/lua /usr/bin/lua
mv ./src/luac /usr/bin/luac
rm /lua-5.3.3.tar.gz
rm -rf /lua-5.3.3

apt-get install -y luarocks git
apt-get remove make gcc -y && apt-get clean
apt-get remove make gcc -y
apt-get autoremove -y
4 changes: 3 additions & 1 deletion nodejs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
FROM tsuru/base-platform
ADD . /var/lib/tsuru/nodejs
RUN cp /var/lib/tsuru/nodejs/deploy /var/lib/tsuru
RUN /var/lib/tsuru/nodejs/install
RUN set -ex; \
/var/lib/tsuru/nodejs/install; \
rm -rf /var/lib/apt/lists/*
3 changes: 2 additions & 1 deletion nodejs/install
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ SOURCE_DIR=/var/lib/tsuru
source ${SOURCE_DIR}/base/rc/config

apt-get update
apt-get install git -y
apt-get install -y --no-install-recommends git

git clone https://github.com/creationix/nvm.git /etc/nvm
cd /etc/nvm && git checkout `git describe --abbrev=0 --tags`

Expand Down
4 changes: 3 additions & 1 deletion perl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
FROM tsuru/base-platform
ADD . /var/lib/tsuru/perl
RUN cp /var/lib/tsuru/perl/deploy /var/lib/tsuru
RUN /var/lib/tsuru/perl/install
RUN set -ex; \
/var/lib/tsuru/perl/install; \
rm -rf /var/lib/apt/lists/*
3 changes: 1 addition & 2 deletions perl/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
# license that can be found in the LICENSE file.

SOURCE_DIR=/var/lib/tsuru

source ${SOURCE_DIR}/base/rc/config

add_repository ppa:pypy/ppa
apt-get update
apt-get install carton make -y
apt-get install -y --no-install-recommends carton make
6 changes: 4 additions & 2 deletions php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

FROM tsuru/base-platform
FROM tsuru/base-platform
ADD . /var/lib/tsuru/php
RUN cp /var/lib/tsuru/php/deploy /var/lib/tsuru
RUN /var/lib/tsuru/php/install
RUN set -ex; \
/var/lib/tsuru/php/install; \
rm -rf /var/lib/apt/lists/*
5 changes: 2 additions & 3 deletions php/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

echo "Deploying the PHP application..."

SOURCE_DIR=/var/lib/tsuru

source ${SOURCE_DIR}/base/deploy
source ${SOURCE_DIR}/base/rc/config

echo "Deploying the PHP application..."

# Deploying
echo "Starting application configuration"
if [ ! -d "${CURRENT_DIR}" ]; then
Expand Down
4 changes: 2 additions & 2 deletions php/install
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

SOURCE_DIR=/var/lib/tsuru
source ${SOURCE_DIR}/base/rc/config

PHP_VERSIONS="5.6 7.0 7.1"

add_repository ppa:ondrej/php
hhvm_repo="deb http://dl.hhvm.com/ubuntu ${UBUNTU_RELEASE} main"
add_repository "${hhvm_repo}" "0x5a16e7281be7a449"

apt-get update
apt-get install python python-yaml git -y --force-yes
apt-get install -y --force-yes --no-install-recommends python python-yaml git

for version in $PHP_VERSIONS
do
Expand All @@ -21,4 +22,3 @@ apt-get install -y hhvm

curl -s -L http://getcomposer.org/composer.phar -o /usr/local/bin/composer_phar
chmod +x /usr/local/bin/composer_phar
apt-get autoclean
4 changes: 3 additions & 1 deletion play/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ FROM tsuru/base-platform
ADD . /var/lib/tsuru/play
RUN cp /var/lib/tsuru/play/deploy /var/lib/tsuru
RUN chmod -R 777 /var/lib/tsuru/play
RUN /var/lib/tsuru/play/install
RUN set -ex; \
/var/lib/tsuru/play/install; \
rm -rf /var/lib/apt/lists/*
4 changes: 3 additions & 1 deletion pypy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
FROM tsuru/base-platform
ADD . /var/lib/tsuru/pypy
RUN cp /var/lib/tsuru/pypy/deploy /var/lib/tsuru
RUN /var/lib/tsuru/pypy/install
RUN set -ex; \
/var/lib/tsuru/pypy/install; \
rm -rf /var/lib/apt/lists/*
1 change: 0 additions & 1 deletion pypy/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# license that can be found in the LICENSE file.

SOURCE_DIR=/var/lib/tsuru

source ${SOURCE_DIR}/base/rc/config

add_repository ppa:pypy/ppa
Expand Down
14 changes: 3 additions & 11 deletions python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@
FROM tsuru/base-platform
ADD . /var/lib/tsuru/python
RUN cp /var/lib/tsuru/python/deploy /var/lib/tsuru
RUN apt-get update && \
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev git && \
/var/lib/tsuru/python/install && \
apt-get remove --purge -y libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev \
tk-dev git && \
apt-get install -y libssl1.0.0 zlib1g libbz2-1.0 \
libreadline6 libsqlite3-0 libncurses5 libncursesw5 && \
apt-get autoremove -y
RUN set -ex; \
/var/lib/tsuru/python/install; \
rm -rf /var/lib/apt/lists/*
ENV PYENV_ROOT="/var/lib/pyenv"
ENV PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
23 changes: 20 additions & 3 deletions python/install
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

APP_VENV=/home/application/.app_env

SOURCE_DIR=/var/lib/tsuru
source ${SOURCE_DIR}/base/rc/config

PY_VERSIONS="2.7.13 3.5.3 3.6.1 3.7-dev"
PY_VERSIONS="2.7.13 3.5.3 3.6.1"
PYENV_ROOT="/var/lib/pyenv"

apt-get update
apt-get install -y --no-install-recommends \
make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev git

git clone https://github.com/pyenv/pyenv.git ${PYENV_ROOT}
git clone https://github.com/pyenv/pyenv-virtualenv.git ${PYENV_ROOT}/plugins/pyenv-virtualenv

Expand All @@ -32,3 +36,16 @@ for pyversion in $PY_VERSIONS; do (pyenv install $pyversion); done
pyenv global 2.7.13

chown -R ${USER}:${USER} $PYENV_ROOT

apt-get remove --purge -y \
libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev llvm \
libncurses5-dev libncursesw5-dev \
tk-dev git

apt-get install -y --no-install-recommends \
libssl1.0.0 zlib1g libbz2-1.0 \
libreadline6 libsqlite3-0 libncurses5 \
libncursesw5

apt-get autoremove -y
4 changes: 3 additions & 1 deletion ruby/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
FROM tsuru/base-platform
ADD . /var/lib/tsuru/ruby
RUN cp /var/lib/tsuru/ruby/deploy /var/lib/tsuru
RUN /var/lib/tsuru/ruby/install
RUN set -ex; \
/var/lib/tsuru/ruby/install; \
rm -rf /var/lib/apt/lists/*
33 changes: 17 additions & 16 deletions ruby/install
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ SOURCE_DIR=/var/lib/tsuru
source ${SOURCE_DIR}/base/rc/config

# Install Essential Packages
apt-get update && apt-get install -y \
nodejs \
ruby \
libgmp-dev \
libgmp3-dev \
zlib1g-dev \
build-essential \
libssl-dev \
libreadline-dev \
libyaml-dev \
libsqlite3-dev \
sqlite3 \
libxml2-dev \
libxslt1-dev \
libcurl4-openssl-dev \
libffi-dev
apt-get update
apt-get install -y --no-install-recommends \
nodejs \
ruby \
libgmp-dev \
libgmp3-dev \
zlib1g-dev \
build-essential \
libssl-dev \
libreadline-dev \
libyaml-dev \
libsqlite3-dev \
sqlite3 \
libxml2-dev \
libxslt1-dev \
libcurl4-openssl-dev \
libffi-dev

echo "export PATH=/home/application/ruby/bin:${PATH} GEM_PATH=/home/application/ruby GEM_HOME=/home/application/ruby BUNDLE_APP_CONFIG=/home/application/ruby/.bundle/config" | tee -a ${HOME}/.profile /etc/profile >/dev/null
Loading

0 comments on commit a615b69

Please sign in to comment.