diff --git a/README.md b/README.md index 00026ee..3f3f32b 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,26 @@ Base docker image for docker apache mod-php. This is a work in progress for now. Will get cleaned up over time. + + +## TODO + +### Write tests + +#### Web tests +- Run web container test as php user, since we don't expect much issues from root. +- test a non existing web endpoint +- test existing web endpoint +- test endpoint that writes session data +- test endpoint that tries to write to / folder +- test executing privileged shell command + +#### Cli +- test workdir +- test composer in path +- test some of the dockerfile stuff (to be defined) + +#### Dev +- we could build a 2nd web-dev container and run dev specific tests there. +- an xdebug test could be done but not as relevant since no network issues expected. +- opcache not caching file changes in dev context is maybe doable diff --git a/docker-compose.test.yml b/docker-compose.test.yml new file mode 100644 index 0000000..d09fa02 --- /dev/null +++ b/docker-compose.test.yml @@ -0,0 +1,43 @@ +version: "3.6" + +services: + sut: + build: + context: test/ + links: + - php + #- php71 + #- php72 + #- php73 + #- php74 + php: + build: . + user: php + +# The following is probably not the best way to go about it. It would run 4x this image at once. +# Keeping as a note until we try test hooks. +# + #php71: + # user: php + # build: + # context: . + # args: + # PHP_VERSION_TAG: 7.1-apache + #php72: + # user: php + # build: + # context: . + # args: + # PHP_VERSION_TAG: 7.2-apache + #php73: + # user: php + # build: + # context: . + # args: + # PHP_VERSION_TAG: 7.3-apache + #php74: + # user: php + # build: + # context: . + # args: + # PHP_VERSION_TAG: 7.4-apache diff --git a/hooks/build b/hooks/build index 4dbc201..7483e3d 100644 --- a/hooks/build +++ b/hooks/build @@ -1,9 +1,9 @@ #!/bin/bash -docker build -f $DOCKERFILE_PATH -t ${IMAGE_NAME} . if [ $DOCKER_TAG == "latest" ]; then + docker build -f $DOCKERFILE_PATH -t ${IMAGE_NAME} . docker build --build-arg PHP_VERSION_TAG=7.1-apache -f $DOCKERFILE_PATH -t $DOCKER_REPO:7.1-latest . docker build --build-arg PHP_VERSION_TAG=7.2-apache -f $DOCKERFILE_PATH -t $DOCKER_REPO:7.2-latest . docker build --build-arg PHP_VERSION_TAG=7.3-apache -f $DOCKERFILE_PATH -t $DOCKER_REPO:7.3-latest . diff --git a/hooks/post_push b/hooks/post_push index e537bb0..dca4f8e 100644 --- a/hooks/post_push +++ b/hooks/post_push @@ -3,9 +3,8 @@ set -e -docker push $IMAGE_NAME - if [ $DOCKER_TAG == "latest" ]; then + docker push $IMAGE_NAME docker push $DOCKER_REPO:7.1-latest docker push $DOCKER_REPO:7.2-latest docker push $DOCKER_REPO:7.3-latest diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 0000000..5e6b7a5 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu:trusty + +RUN apt-get update && apt-get install -yq curl netcat && apt-get clean + +WORKDIR /app + +ADD test.sh /app/test.sh + +CMD ["bash", "test.sh"] diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 0000000..983219c --- /dev/null +++ b/test/test.sh @@ -0,0 +1,5 @@ +#!/bin/bash + + +# TODO write tests +exit 0