From 93ffe534e5c047feb96fcb7268f561d4c3e6a3a5 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 7 Sep 2014 00:54:43 +0200 Subject: [PATCH] Added README; Fixed container startup --- Dockerfile | 2 +- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ files/container-run.sh | 4 ++++ playbook.yml | 3 +++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 README.md create mode 100644 files/container-run.sh diff --git a/Dockerfile b/Dockerfile index 1db1859..0b23fdf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,4 @@ RUN \ EXPOSE 80 -CMD ["nginx"] +CMD ["/usr/local/bin/container-run.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..8496d57 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# luzifer/php5-nginx Dockerfile + +This repository contains **Dockerfile** of [Nginx](http://nginx.org/) for [Docker](https://www.docker.com/)'s [automated build](https://registry.hub.docker.com/u/luzifer/php5-nginx/) published to the public [Docker Hub Registry](https://registry.hub.docker.com/). + +## Base Docker Image + +- [ubuntu](https://registry.hub.docker.com/_/ubuntu/) + +## Installation + +1. Install [Docker](https://www.docker.com/). + +2. Download [automated build](https://registry.hub.docker.com/u/luzifer/php5-nginx/) from public [Docker Hub Registry](https://registry.hub.docker.com/): `docker pull luzifer/php5-nginx` + + (alternatively, you can build an image from Dockerfile: `docker build -t="luzifer/php5-nginx" github.com/luzifer/php5-nginx`) + +## Usage + +Create a `Dockerfile` similar to the following in your application code folder: + +``` +FROM luzifer/php5-nginx + +ONBUILD RUN mkdir -p /application +ONBUILD ADD . /application + +EXPOSE 80 +CMD ["/usr/local/bin/container-run.sh"] +``` + +Then, execute the following to build the image: + + docker build -t myuser/myapp . + +This will create an image named `myuser/myapp` with your application ready to go. +To launch it, just type: + + docker run -d -p 80 myuser/myapp + +Easy! + + diff --git a/files/container-run.sh b/files/container-run.sh new file mode 100644 index 0000000..ed00c3f --- /dev/null +++ b/files/container-run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +/etc/init.d/spawn-fcgi start +exec nginx diff --git a/playbook.yml b/playbook.yml index af43586..1f4668d 100644 --- a/playbook.yml +++ b/playbook.yml @@ -4,5 +4,8 @@ tasks: - include: tasks/nginx.yml + - name: Make entrypoint for docker container + copy: src=files/container-run.sh dest=/usr/local/bin/container-run.sh mode=0755 owner=root group=root + handlers: - include: handlers/nginx.yml