Skip to content

Commit

Permalink
REL-0.10 Move to devilbox namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Oct 1, 2017
1 parent fcdb23f commit 0a1815d
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 109 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ env:
# travis encrypt DOCKER_USERNAME=user
# travis encrypt DOCKER_PASSWORD=pass
# Must be regenerated when repository name/owner changes
- secure: "bMj1ln7Ip3DznFHElfL8s6CIyedB0XH5oJeb6DJ2Afqxj8EvJFMm/5ESI3ZeKXD3M1/vBUB6TNqhaO/pEkmN5N+gggSwO9Y0JIA5v481kvl9hOuZNCiS17WM32zUmSpHWjfkRYTQLKi6nIorQGjjcbW4JeypRrYdz+ty/MP+XYULanc9ssi4DCwIhnvOB3+kBM+TooZpqGWtPRusMQL1DQP+Eh7K794kgvL3HLBE9buIwWjSsrw+r1+hKSH9n+XT1dqUkn9qxVKvQ02K4/ETPTQ/jFcBIXER8P3Uw2RhbES+OzMvTI5AXu5on8egEjMhyAmlGM88GO09cfBn2/5E7cMuT2gvHIWND/58cNAyjLuXLuVyHTZxnXTuPmQUh62Trz0JDR6/fHEow8Bgx5e7boeKxiDW0dOodKNjoBlDqJuY97hdQVC8r0HxWLSZMg099gVf/++Za44lpsFOlWO37NG7BpGNohVOWzKLPoxF9kW2SCXelmMeus67TPBBM04BtmvtviUZUspNeeP1utatens3DV6I0V48EOtP12e3+C6b6at0WUSt5HVC5AFYxjqzDhNYU+tkIjmJBs8/etHxoTSnqzPtVYaxZriu5awz/nOAieEXqWDGiFEcjNWbWzg9CwcUjaCO46OpChgD0dBPWtJ7AbxH3VeDjz7eeunTgwo="
- secure: "BJw58eb5AbOZc/Jk7IfEY7GCc2iLh+RCCt3UqN/SY7Q1We9cx5OS6Tmxq/Kyb+aWYefMxJiKPVz1btki5enq/BzlQsQSfJZCY/qqt6SRqpU+sfzKIUsMhnpw6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30qw/nRlXcNAMviUannBcnEyayPtwUw2EEKQQIzmSPkBcv3AVnBPfdrAVinY4S/ll+q2FlVvFjqUUsDZKFhAw0hls6iH/fUw7UnckddP7bqfvBUmwMHhskoo8lu0bV1Owk4lBqmUFJkQcHl+0zvVythBjRCyktrvTLAjfvS/7HdxQPIat0K/O7J9Jbhg7UJdzQ="
# DOCKER_PASSWORD
- secure: "edwTPNiI46GqX1wCVhN1xfrE1QEvDImEDz/aL2DYZo/W5Y3h4Y7HzJh4E8nb0gtYeJmoNRpDde/mTxDFtzOX0EzcAygjKrwbxEO063/Y2x6odIcRV/XU+OPnTpLL1jwQsb+kWgdTnl1E/Y5IO+8+Dhlb4l4tvRC50r4sU8iDZFXNj5B5SRzAXTlERkccL83JxA8qGRn9u8+w97vglMyXK4/fnae4KIb6pcv3flkiw//uq5lQyqdIbLqxa+aY99zatgmmYcrum5WiuSBWHdUMaB4W6KulvGnrUWYujQldTAQ8967stWbWta+qMQ2G3hFfA80mmmJo2U0R+IHocvrhQczxcVja7Lcqfqs/6SSlK0vO3U5XV/jBYhHAj8jjKAQI0Z9sRvK6cnH/MXxzJLtnpYC/AB+CL7Ou1PQLVVxZ/0gXmRFgg4oOXmdupymBpI8zQanJ9VvLfljephLs5MeR6994ZJQJ8/mG/HGxh2yempN0NED2jZZjnqXbsWCimjeNN0hhKhEQFZZ5654aG62eWKhfaI1ril7lc2ba8VnMeRTEE7htM4wfhEHVdiXdpir8zfn8sydHvmaH/vO+M3zuCTKJg9MwBvzuANQBy5Ae9YtMzHETM86wfXqZ1e5E0iaWYccZaeGSGIpS8mIpt5uwDOPMRaL4teJ4SNzlZEa7XBM="
matrix:
- TEST=0
- TEST=1
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ MAINTAINER "cytopia" <cytopia@everythingcli.org>
LABEL \
name="cytopia's Nginx Image" \
image="nginx-stable" \
vendor="cytopia" \
vendor="devilbox" \
license="MIT" \
build-date="2017-09-30"
build-date="2017-10-01"


###
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

<sub>This Docker image is part of the **[devilbox](https://github.com/cytopia/devilbox)**.</sub>

**[Apache 2.2](https://github.com/cytopia/docker-apache-2.2) | [Apache 2.4](https://github.com/cytopia/docker-apache-2.4) | Nginx stable | [Nginx mainline](https://github.com/cytopia/docker-nginx-mainline)**
**[Apache 2.2](https://github.com/devilbox/docker-apache-2.2) | [Apache 2.4](https://github.com/devilbox/docker-apache-2.4) | Nginx stable | [Nginx mainline](https://github.com/devilbox/docker-nginx-mainline)**

[![Build Status](https://travis-ci.org/cytopia/docker-nginx-stable.svg?branch=master)](https://travis-ci.org/cytopia/docker-nginx-stable) [![](https://images.microbadger.com/badges/version/cytopia/nginx-stable.svg)](https://microbadger.com/images/cytopia/nginx-stable "nginx-stable") [![](https://images.microbadger.com/badges/image/cytopia/nginx-stable.svg)](https://microbadger.com/images/cytopia/nginx-stable "nginx-stable") [![](https://images.microbadger.com/badges/license/cytopia/nginx-stable.svg)](https://microbadger.com/images/cytopia/nginx-stable "nginx-stable")
[![Build Status](https://travis-ci.org/devilbox/docker-nginx-stable.svg?branch=master)](https://travis-ci.org/devilbox/docker-nginx-stable) [![](https://images.microbadger.com/badges/version/devilbox/nginx-stable.svg)](https://microbadger.com/images/devilbox/nginx-stable "nginx-stable") [![](https://images.microbadger.com/badges/image/devilbox/nginx-stable.svg)](https://microbadger.com/images/devilbox/nginx-stable "nginx-stable") [![](https://images.microbadger.com/badges/license/devilbox/nginx-stable.svg)](https://microbadger.com/images/devilbox/nginx-stable "nginx-stable")

This image is based on the official **[Nginx (stable)](https://hub.docker.com/_/nginx/)** Docker image and extends it with the ability to have **virtual hosts created automatically** when adding new directories. For that to work, it integrates two tools that will take care about the whole process: **[watcherd]()** and **[vhost-gen]()**.
This image is based on the official **[Nginx (stable)](https://hub.docker.com/_/nginx/)** Docker image and extends it with the ability to have **virtual hosts created automatically** when adding new directories. For that to work, it integrates two tools that will take care about the whole process: **[watcherd](https://github.com/devilbox/watcherd)** and **[vhost-gen](https://github.com/devilbox/vhost-gen)**.

From a users perspective, you mount your local project directory into the Docker under `/shared/httpd`. Any directory then created in your local project directory wil spawn a new virtual host by the same name. Additional settings such as custom server names, PHP-FPM or even different nginx templates per project are supported as well.

----

Find me on **[Docker Hub](https://hub.docker.com/r/cytopia/nginx-stable)**:
Find me on **[Docker Hub](https://hub.docker.com/r/devilbox/nginx-stable)**:

[![cytopia/nginx-stable](http://dockeri.co/image/cytopia/nginx-stable)](https://hub.docker.com/r/cytopia/nginx-stable/)
[![devilbox/nginx-stable](http://dockeri.co/image/devilbox/nginx-stable)](https://hub.docker.com/r/devilbox/nginx-stable/)

<small>**Latest build:** 2017-09-30</small>
<small>**Latest build:** This container is built every night by [travis-ci](https://travis-ci.org/devilbox/docker-nginx-stable).</small>

----

Expand Down Expand Up @@ -170,14 +170,14 @@ Mount your local directort `~/my-host-www` into the docker and server those file

**Note:** Files will be server from `~/my-host-www/htdocs`.
```bash
$ docker run -d -p 80:80 -v ~/my-host-www:/var/www/default -t cytopia/nginx-stable
$ docker run -d -p 80:80 -v ~/my-host-www:/var/www/default -t devilbox/nginx-stable
```

#### 2. Serve PHP files with PHP-FPM

Note, for this to work, the `~/my-host-www` dir must be mounted into the Nginx Docker as well as into the php-fpm docker.

You can also attach other PHP-FPM version: [PHP-FPM 5.4](https://github.com/cytopia/docker-php-fpm-5.4), [PHP-FPM 5.5](https://github.com/cytopia/docker-php-fpm-5.5), [PHP-FPM 5.6](https://github.com/cytopia/docker-php-fpm-5.6), [PHP-FPM 7.0](https://github.com/cytopia/docker-php-fpm-7.0) or [PHP-FPM 7.1](https://github.com/cytopia/docker-php-fpm-7.1)
You can also attach other PHP-FPM version: [PHP-FPM 5.4](https://github.com/cytopia/docker-php-fpm-5.4), [PHP-FPM 5.5](https://github.com/cytopia/docker-php-fpm-5.5), [PHP-FPM 5.6](https://github.com/cytopia/docker-php-fpm-5.6), [PHP-FPM 7.0](https://github.com/cytopia/docker-php-fpm-7.0), [PHP-FPM 7.1](https://github.com/cytopia/docker-php-fpm-7.1), [PHP-FPM 7.2](https://github.com/cytopia/docker-php-fpm-7.2) or [HHVM](https://github.com/cytopia/docker-hhvm-latest).

Each PHP-FPM docker also has the option to enable Xdebug and more, see their respective Readme files for futher settings.

Expand All @@ -193,7 +193,7 @@ $ docker run -d \
-e PHP_FPM_SERVER_ADDR=php \
-e PHP_FPM_SERVER_PORT=9000 \
--link php \
-t cytopia/nginx-stable
-t devilbox/nginx-stable
```

#### 3. Fully functional LEMP stack
Expand Down Expand Up @@ -228,7 +228,7 @@ $ docker run -d \
-e PHP_FPM_SERVER_PORT=9000 \
--link php \
--link mysql \
-t cytopia/nginx-stable
-t devilbox/nginx-stable
```

#### 4. Ultimate pre-configured docker-compose setup
Expand Down
19 changes: 13 additions & 6 deletions build/docker-attach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,32 @@ if [ ! -f "${CWD}/Dockerfile" ]; then
exit 1
fi

# Get docker Name
# Test Docker name
if ! grep -q 'image=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'image' LABEL found"
exit
fi

# Make sure exactly 1 container is running
# Test Docker vendor
if ! grep -q 'vendor=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'vendor' LABEL found"
exit
fi

# Retrieve values
NAME="$( grep 'image=".*"' "${CWD}/Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )"
COUNT="$( docker ps | grep -c "cytopia/${NAME}" || true)"
VEND="$( grep -Eo 'vendor="(.*)"' "${CWD}/Dockerfile" | awk -F'"' '{print $2}' )"
COUNT="$( docker ps | grep -c "${VEND}/${NAME}" || true)"
if [ "${COUNT}" != "1" ]; then
echo "${COUNT} 'cytopia/${NAME}' container running. Unable to attach."
echo "${COUNT} '${VEND}/${NAME}' container running. Unable to attach."
exit 1
fi


###
### Attach
###
DID="$(docker ps | grep "cytopia/${NAME}" | awk '{print $1}')"
DID="$(docker ps | grep "${VEND}/${NAME}" | awk '{print $1}')"

echo "Attaching to: cytopia/${NAME}"
echo "Attaching to: ${VEND}/${NAME}"
run "docker exec -it ${DID} env TERM=xterm /bin/bash -l"
18 changes: 13 additions & 5 deletions build/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,21 @@ if [ ! -f "${CWD}/Dockerfile" ]; then
exit 1
fi

# Get docker Name
# Test Docker name
if ! grep -q 'image=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'image' LABEL found"
exit
fi

# Test Docker vendor
if ! grep -q 'vendor=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'vendor' LABEL found"
exit
fi

# Retrieve values
NAME="$( grep 'image=".*"' "${CWD}/Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )"
VEND="$( grep -Eo 'vendor="(.*)"' "${CWD}/Dockerfile" | awk -F'"' '{print $2}' )"
DATE="$( date '+%Y-%m-%d' )"


Expand All @@ -53,18 +62,17 @@ run "docker pull ${MY_BASE}"
###

# Update build date
run "sed -i'' 's/<small>\*\*Latest\sbuild.*/<small>**Latest build:** ${DATE}<\/small>/g' ${CWD}/README.md"
run "sed -i'' 's/build-date=\".*\"/build-date=\"${DATE}\"/g' ${CWD}/Dockerfile"

# Build Docker
run "docker build -t cytopia/${NAME} ${CWD}"
run "docker build -t ${VEND}/${NAME} ${CWD}"


###
### Retrieve information afterwards and Update README.md
###
docker run -d --rm --name my_tmp_${NAME} -t cytopia/${NAME}
INFO="$( docker exec my_tmp_${NAME} nginx -V 2>&1 | grep -E '^(nginx|built|TLS)' )"
docker run -d --rm --name my_tmp_${NAME} -t ${VEND}/${NAME}
INFO="$( docker exec my_tmp_${NAME} httpd -V | grep -E '^Server.*(version|built|Module|loaded|MPM)' )"
docker stop "$(docker ps | grep "my_tmp_${NAME}" | awk '{print $1}')" > /dev/null

INFO="$( echo "${INFO}" | sed 's/\s$//g' )" # remove trailing space
Expand Down
13 changes: 11 additions & 2 deletions build/docker-enter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,24 @@ if [ ! -f "${CWD}/Dockerfile" ]; then
exit 1
fi

# Get docker Name
# Test Docker name
if ! grep -q 'image=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'image' LABEL found"
exit
fi

# Test Docker vendor
if ! grep -q 'vendor=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'vendor' LABEL found"
exit
fi

# Retrieve values
NAME="$( grep 'image=".*"' "${CWD}/Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )"
VEND="$( grep -Eo 'vendor="(.*)"' "${CWD}/Dockerfile" | awk -F'"' '{print $2}' )"


###
### Enter
###
run "docker run -i --entrypoint /bin/bash -t cytopia/${NAME}"
run "docker run -i --entrypoint /bin/bash -t ${VEND}/${NAME}"
75 changes: 0 additions & 75 deletions build/docker-push.sh

This file was deleted.

18 changes: 13 additions & 5 deletions build/docker-rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,21 @@ if [ ! -f "${CWD}/Dockerfile" ]; then
exit 1
fi

# Get docker Name
# Test Docker name
if ! grep -q 'image=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'image' LABEL found"
exit
fi

# Test Docker vendor
if ! grep -q 'vendor=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'vendor' LABEL found"
exit
fi

# Retrieve values
NAME="$( grep 'image=".*"' "${CWD}/Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )"
VEND="$( grep -Eo 'vendor="(.*)"' "${CWD}/Dockerfile" | awk -F'"' '{print $2}' )"
DATE="$( date '+%Y-%m-%d' )"


Expand All @@ -53,18 +62,17 @@ run "docker pull ${MY_BASE}"
###

# Update build date
run "sed -i'' 's/<small>\*\*Latest\sbuild.*/<small>**Latest build:** ${DATE}<\/small>/g' ${CWD}/README.md"
run "sed -i'' 's/build-date=\".*\"/build-date=\"${DATE}\"/g' ${CWD}/Dockerfile"

# Build Docker
run "docker build --no-cache -t cytopia/${NAME} ${CWD}"
run "docker build --no-cache -t ${VEND}/${NAME} ${CWD}"


###
### Retrieve information afterwards and Update README.md
###
docker run -d --rm --name my_tmp_${NAME} -t cytopia/${NAME}
INFO="$( docker exec my_tmp_${NAME} nginx -V 2>&1 | grep -E '^(nginx|built|TLS)' )"
docker run -d --rm --name my_tmp_${NAME} -t ${VEND}/${NAME}
INFO="$( docker exec my_tmp_${NAME} httpd -V | grep -E '^Server.*(version|built|Module|loaded|MPM)' )"
docker stop "$(docker ps | grep "my_tmp_${NAME}" | awk '{print $1}')" > /dev/null

INFO="$( echo "${INFO}" | sed 's/\s$//g' )" # remove trailing space
Expand Down
15 changes: 13 additions & 2 deletions build/docker-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,23 @@ if [ ! -f "${CWD}/Dockerfile" ]; then
exit 1
fi

# Get docker Name

# Test Docker name
if ! grep -q 'image=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'image' LABEL found"
exit
fi

# Test Docker vendor
if ! grep -q 'vendor=".*"' "${CWD}/Dockerfile" > /dev/null 2>&1; then
echo "No 'vendor' LABEL found"
exit
fi

# Retrieve values
NAME="$( grep 'image=".*"' "${CWD}/Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )"
VEND="$( grep -Eo 'vendor="(.*)"' "${CWD}/Dockerfile" | awk -F'"' '{print $2}' )"


###
### Run
Expand All @@ -46,4 +57,4 @@ _args=""
if [ "${#}" != "0" ]; then
_args="${*}"
fi
run "docker run -it ${_args} cytopia/${NAME}"
run "docker run -it ${_args} ${VEND}/${NAME}"

0 comments on commit 0a1815d

Please sign in to comment.