Skip to content
This repository was archived by the owner on Mar 4, 2019. It is now read-only.

Commit 6e34bbf

Browse files
committed
Building a docker image.
1 parent 454dd85 commit 6e34bbf

File tree

4 files changed

+54
-12
lines changed

4 files changed

+54
-12
lines changed

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### This file can be used to build a docker image like this:
2+
### docker build --tag='btr_client' .
3+
### It can also be used for automated builds in Docker Hub
4+
### (see https://docs.docker.com/userguide/dockerrepos/#automated-builds)
5+
6+
FROM ubuntu:14.04
7+
8+
### Install packages first, in order to take advantage
9+
### of caching features of `docker build`.
10+
COPY install/scripts/packages-and-software.sh /tmp/
11+
RUN DEBIAN_FRONTEND=noninteractive /tmp/packages-and-software.sh
12+
13+
### Copy the source code and run the installer.
14+
COPY . /usr/local/src/btr_client/
15+
ENV code_dir /usr/local/src/btr_client
16+
WORKDIR /usr/local/src/btr_client/
17+
RUN ["install/install-container.sh", "install/settings.sh"]
18+
19+
### Set the default command to run in the container.
20+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf", "--nodaemon"]
21+

README.org

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Drupal installation profile for B-Translator Client.
2929
/etc/init.d/chroot-bcl stop
3030
#+END_EXAMPLE
3131

32+
3233
* Installation in a docker container
3334

3435
This is almost the same as the installation above, except that
@@ -43,6 +44,22 @@ Drupal installation profile for B-Translator Client.
4344
docker.io stop bcl
4445
#+END_EXAMPLE
4546

47+
Compared to the installation with chroot, docker has the advantage
48+
that it is platform independent (the host system does not have to be
49+
Ubuntu or Debian).
50+
51+
52+
* Building with docker
53+
54+
Another way is to use the command =docker build= to build an image
55+
and then =docker run= to create a container from this image:
56+
#+BEGIN_EXAMPLE
57+
vim btr_client/install/settings.sh
58+
docker.io build --tag=btr_client btr_client/
59+
docker.io run -d --name=bcl --hostname=example.org \
60+
-p 80:80 -p 443:443 btr_client
61+
#+END_EXAMPLE
62+
4663

4764
* What is B-Translator
4865

install/install-and-config.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ sed -i /etc/hosts \
55
-e "/^127.0.0.1/c 127.0.0.1 example.org localhost"
66
hostname example.org
77

8-
### export drupal_dir
9-
export drupal_dir=/var/www/bcl
10-
export drush="drush --root=$drupal_dir"
11-
128
### go to the directory of scripts
139
cd $code_dir/install/scripts/
1410

1511
### additional packages and software
1612
./packages-and-software.sh
1713

1814
### make and install the drupal profile 'btr_client'
15+
export drupal_dir=/var/www/bcl
16+
export drush="drush --root=$drupal_dir"
1917
./drupal-make-and-install.sh
2018

2119
### additional configurations related to drupal

install/scripts/packages-and-software.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
#!/bin/bash -x
22

3+
### if packages have been already installed, don't do it again
4+
if test -f /tmp/packages-installed
5+
then
6+
exit 0
7+
else
8+
touch /tmp/packages-installed
9+
fi
10+
311
### upgrade packages
412
apt-get update
513
apt-get -y upgrade
614

7-
install='apt-get -y -o DPkg::Options::=--force-confdef -o DPkg::Options::=--force-confold install'
8-
915
### install localization
10-
$install language-pack-en
16+
apt-get -y install language-pack-en
1117
update-locale
1218

1319
### install other needed packages
14-
$install aptitude tasksel vim nano psmisc cron supervisor
15-
$install mysql-server ssmtp memcached php5-memcached \
20+
apt-get -y install aptitude tasksel vim nano psmisc cron supervisor
21+
apt-get -y install mysql-server ssmtp memcached php5-memcached \
1622
php5-mysql php5-gd php-db php5-dev php-pear php5-curl php-apc \
1723
make ssl-cert gawk unzip wget curl diffutils phpmyadmin git ruby
18-
$install screen logwatch
24+
apt-get -y install screen logwatch
1925
initctl reload-configuration
2026

2127
### install hub: http://hub.github.com/
@@ -24,7 +30,7 @@ chmod +x /bin/hub
2430

2531
### install twitter cli client
2632
### see also: http://xmodulo.com/2013/12/access-twitter-command-line-linux.html
27-
$install ruby-dev
33+
apt-get -y install ruby-dev
2834
gem install t
2935

3036
### phpmyadmin will install apache2 and start it
@@ -33,7 +39,7 @@ gem install t
3339
update-rc.d apache2 disable
3440

3541
### install nginx and php5-fpm
36-
$install nginx nginx-common nginx-full php5-fpm
42+
apt-get -y install nginx nginx-common nginx-full php5-fpm
3743

3844
### There is some problem with php-pear in 14.04
3945
### See: http://askubuntu.com/questions/451953/php-pear-is-not-working-after-upgrading-to-ubuntu-14-04

0 commit comments

Comments
 (0)