Commit fdabcc4b authored by Ernesto Rodriguez Ortiz's avatar Ernesto Rodriguez Ortiz
Browse files

first commit

parents
# docker Drupal
#
# VERSION 0.2
# DOCKER-VERSION 0.4
FROM ubuntu:14.04
MAINTAINER Ricardo Amaro <mail@ricardoamaro.com>
#RUN echo "deb http://archive.ubuntu.com/ubuntu saucy main restricted universe multiverse" > /etc/apt/sources.list
RUN apt-get update
#RUN apt-get -y upgrade
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -sf /bin/true /sbin/initctl
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install curl wget git mysql-client mysql-server apache2 libapache2-mod-php5 pwgen python-setuptools vim-tiny php5-mysql php-apc php5-gd php5-curl php5-memcache memcached mc php-pear
RUN DEBIAN_FRONTEND=noninteractive apt-get autoclean
RUN pear channel-discover pear.drush.org && pear install drush/drush
# Make mysql listen on the outside
RUN sed -i "s/^bind-address/#bind-address/" /etc/mysql/my.cnf
RUN easy_install supervisor
COPY ./deploy/jenkins-post-build.sh /jenkins-post-build.sh
COPY ./deploy/foreground.sh /etc/apache2/foreground.sh
COPY ./deploy/supervisord.conf /etc/supervisord.conf
#Drupal make
COPY ./sfl/sflinux.make /var/www/drupal/sflinux.make
COPY ./sfl/drupal-org-core.make /var/www/drupal/drupal-org-core.make
# Retrieve drupal
RUN mkdir /var/www/drupal; cd /var/www/drupal ; drush make --prepare-install sflinux.make src --yes
RUN drush status
RUN chmod a+w /var/www/drupal/src/sites/default ; chown -R www-data:www-data /var/www/drupal
RUN rm /var/www/drupal/src/sites/default/settings.php
#Add profile
COPY ./sfl/sflinux /var/www/drupal/src/profiles/sflinux
#Copy vhost configuration and enable modules
COPY ./deploy/vhost.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite vhost_alias
RUN service apache2 restart
RUN chmod 755 /jenkins-post-build.sh /etc/apache2/foreground.sh
EXPOSE 80
CMD ["/bin/bash", "/jenkins-post-build.sh"]
This diff is collapsed.
docker-drupal
=============
This repo contains a recipe for making a [Docker](http://docker.io) container for Drupal, using Linux, Apache and MySQL.
To build, make sure you have Docker [installed](http://www.docker.io/gettingstarted/).
This will try to go in line with [Drupal automated-testing](https://drupal.org/automated-testing).
## kill any running docker daemon
```
sudo killall docker
```
## Install docker:
```
curl get.docker.io | sudo sh -x
```
## Clone this repo somewhere,
```
git clone https://github.com/ricardoamaro/docker-drupal.git
cd docker-drupal
```
and then build it:
```
sudo docker build -t <yourname>/drupal .
```
this can take a while but should eventually return a command prompt. It's done when it says "Successfully built {hash}"
## And run the container, connecting port 80:
```
sudo docker run -d -t -p 80:80 <yourname>/drupal
```
That's it!
Visit http://localhost/ in your webrowser.
Note: you cannot have port 80 already used or the container will not start.
In that case you can start by setting: `-p 8080:80`
build directly from github is broken at the moment:
```
sudo docker build -t <yourname>/drupal git://github.com/ricardoamaro/docker-drupal.git
```
### Credentials
* ROOT MYSQL_PASSWORD will be on /mysql-root-pw.txt
* DRUPAL MYSQL PASSWORD will be on /drupal-db-pw.txt
* Drupal account-name=admin & account-pass=admin
## More docker awesomeness
This will create an ID that you can start/stop/commit changes:
```
# sudo docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
538114c20d36 <yourname>/drupal:latest /bin/bash /start.sh 3 minutes ago Up 6 seconds 80->80
```
Start/Stop
```
sudo docker stop 538114c20d36
sudo docker start 538114c20d36
```
Commit the actual state to the image
```
sudo docker commit 538114c20d36 <yourname>/drupal
```
Starting again with the commited changes
```
sudo docker run -d -t -p 80:80 <yourname>/drupal /start.sh
```
Shipping the container image elsewhere
```
sudo docker push <yourname>/drupal
```
You can find more images using the [Docker Index][docker_index].
ricardoamaro/drupal-lamp
### Clean up
While i am developing i use this to rm all old instances
```
sudo docker ps -a | awk '{print $1}' | grep -v CONTAINER | xargs -n1 -I {} docker rm {}
```
### Known Issues
* Upstart on Docker is broken due to [this issue][docker_upstart_issue], and that's one of the reasons the image is puppetized using vagrant.
* Warning: This is still in development and ports shouldn't be open to the outside world.
## Contributing
Feel free to fork and contribute to this code. :)
1. Fork the repo
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Authors
Created and maintained by [Ricardo Amaro][author] (<mail_at_ricardoamaro.com>)
## License
GPL v3
[author]: https://github.com/ricardoamaro
[docker_upstart_issue]: https://github.com/dotcloud/docker/issues/223
[docker_index]: https://index.docker.io/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment