Skip to content

Commit

Permalink
Merge pull request #14 from devilbox/release-0.19
Browse files Browse the repository at this point in the history
Use latest vhost-gen version
  • Loading branch information
cytopia authored Aug 2, 2018
2 parents b249d61 + c92fdff commit 96f5e03
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 173 deletions.
12 changes: 0 additions & 12 deletions .ci/.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ set -u
set -o pipefail


###
### Variables
###
CWD="$( dirname "${0}" )"


###
### Run
###
Expand Down Expand Up @@ -45,9 +39,3 @@ function get_random_name() {
done
echo "${name}"
}


DOCKER_IMAGE="$( grep 'image=".*"' "${CWD}/../Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )"
DOCKER_VENDOR="$( grep 'vendor=".*"' "${CWD}/../Dockerfile" | sed 's/^[[:space:]]*//g' | awk -F'"' '{print $2}' )"
# shellcheck disable=SC2034
DOCKER_NAME="${DOCKER_VENDOR}/${DOCKER_IMAGE}"
11 changes: 3 additions & 8 deletions .ci/00.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -u
set -o pipefail

CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
DOCKER_NAME="${1}"


###
Expand All @@ -23,12 +24,6 @@ RAND_NAME="$( get_random_name )"
run "echo \"hello world\" > ${RAND_DIR}/index.html"


###
### Build container
###
run "docker build -t ${DOCKER_NAME} ${CWD}/.."


###
### Startup container
###
Expand All @@ -48,8 +43,8 @@ run "docker run -d --rm \
run "sleep 5"
run "docker ps"
run "docker logs ${RAND_NAME}"
run "curl localhost"
run "curl localhost | grep 'hello world'"
run "curl -sS localhost/index.html"
run "curl -sS localhost/index.html | grep 'hello world'"


###
Expand Down
1 change: 1 addition & 0 deletions .ci/01.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -u
set -o pipefail

CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
DOCKER_NAME="${1}"


###
Expand Down
26 changes: 5 additions & 21 deletions .ci/start-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,11 @@ IFS=$'\n'

# Current directory
CWD="$( dirname "${0}" )"
IMAGE="${1}"

declare -a TESTS=()


###
### Sanity checks
###

# Check Dockerfile
if [ ! -f "${CWD}/../Dockerfile" ]; then
echo "Dockerfile not found in: ${CWD}/../Dockerfile."
exit 1
fi

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


###
### Run tests
###
Expand All @@ -44,13 +28,13 @@ for f in ${FILES}; do
done

# Start a single test
if [ "${#}" -eq "1" ]; then
sh -c "${TESTS[${1}]}"
if [ "${#}" -eq "2" ]; then
sh -c "${TESTS[${2}]} ${IMAGE}"

# Run all tests
else
for i in "${TESTS[@]}"; do
echo "sh -c ${CWD}/${i}"
sh -c "${i}"
echo "sh -c ${CWD}/${i} ${IMAGE}"
sh -c "${i} ${IMAGE}"
done
fi
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ install:
- max=100; i=0; while [ $i -lt $max ]; do if sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce; then break; else i=$((i+1)); fi done
- docker version
script:
- .ci/start-ci.sh "${TEST}" "${IMAGE}"
- make build
- make test ARG=${TEST}


###
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
FROM httpd:2.2
MAINTAINER "cytopia" <cytopia@everythingcli.org>

LABEL \
name="cytopia's apache 2.2 image" \
image="devilbox/apache-2.2" \
vendor="devilbox" \
license="MIT"

###
### Build arguments
###
ARG VHOST_GEN_GIT_REF=0.7
ARG VHOST_GEN_GIT_REF=0.10
ARG CERT_GEN_GIT_REF=0.2

ENV BUILD_DEPS \
Expand Down
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
image = devilbox/apache-2.2

help:
@printf "%s\n" "make build: Build"
@printf "%s\n" "make rebuild: Rebuild"
@printf "%s\n" "make test: Test"


build: pull
docker build -t $(image) .
cd build; ./gen-readme.sh $(image)

rebuild: pull
docker build --no-cache -t $(image) .
cd build; ./gen-readme.sh $(image)

test:
.ci/start-ci.sh $(image) $(ARG)

pull:
docker pull $(shell grep FROM Dockerfile | sed 's/^FROM//g'; done)
65 changes: 0 additions & 65 deletions build/docker-build.sh

This file was deleted.

65 changes: 0 additions & 65 deletions build/docker-rebuild.sh

This file was deleted.

20 changes: 20 additions & 0 deletions build/gen-readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh -eu


###
### Globals
###
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)/.."
IMAGE="${1}"

###
### Retrieve information afterwards and Update README.md
###
INFO="$( docker run -it --rm --entrypoint=httpd ${IMAGE} -V 2>&1 | tr -d "\r" )"

echo "${INFO}"
sed -i'' '/##[[:space:]]Version/q' "${CWD}/README.md"
echo "" >> "${CWD}/README.md"
echo '```' >> "${CWD}/README.md"
echo "${INFO}" >> "${CWD}/README.md"
echo '```' >> "${CWD}/README.md"
2 changes: 2 additions & 0 deletions data/vhost-gen/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ vhost:
# Array of indecies to serve as default files (e.g.: index.php, index.html, etc)
index:
- index.php
- index.html
- index.htm
# SSL Definition
ssl:
dir_crt: /etc/httpd/cert/main
Expand Down

0 comments on commit 96f5e03

Please sign in to comment.