Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
43 changes: 43 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion hooks/build
Original file line number Diff line number Diff line change
@@ -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 .
Expand Down
3 changes: 1 addition & 2 deletions hooks/post_push
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
5 changes: 5 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash


# TODO write tests
exit 0