From 377b39aa5322d8eeb33d0093da5d5f7266696e44 Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 16:31:17 +0000 Subject: [PATCH 01/10] my changes --- .circleci/config.yml | 11 ----------- src/index.php | 4 ---- 2 files changed, 15 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 155cf44..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: circleci/php:7.0-apache - steps: - - checkout - - setup_remote_docker - - run: docker build -t mfieldhouse/docker-php-helloworld:$CIRCLE_BRANCH . - - diff --git a/src/index.php b/src/index.php index 3104b81..a1e063b 100644 --- a/src/index.php +++ b/src/index.php @@ -1,7 +1,3 @@ "; -echo "Hello ECS!
"; -echo ''; - ?> From 8e944faca140e19a8afca05197114da48ae61e4b Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 16:35:56 +0000 Subject: [PATCH 02/10] updating readme --- README.md | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 229a183..244af8e 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,10 @@ # How it Works -Docker builds an image containing the application in src/ and all of its dependencies by using the Dockerfile contained in this repository. -The Dockerfile tells docker to use the [official PHP Docker image](https://hub.docker.com/_/php/) as the parent image. +## Setup -The PHP image then uses the [official Debian Jessie Docker image](https://hub.docker.com/_/debian/) as its parent image. +``` +docker build -t docker-php-helloworld .` +docker run -p 80:80 docker-php-helloworld` +``` -Debian then uses the [scratch image](https://hub.docker.com/_/scratch/) as its base image. - -At this point, an image has been built which contains Apache, PHP and all of the OS dependencies and libraries required to serve a webpage written in PHP. - -Finally, docker copies everything in src/ inside this repository to the /var/www/html folder inside the image. This is the Apache web root directory. - -# Setup - - - Ensure you have Docker installed - - `git clone` this repository - - `sudo docker build -t docker-php-helloworld .` - - `sudo docker run -p 80:80 docker-php-helloworld` - -# What You Should See - -![Docker PHP App](https://image.ibb.co/cTxSf7/whale.png "Hello World") - -This was originally created to test Amazon Elastic Container Service which is why Moby Dock says "Hello ECS!" From 07c16fd03420f0ae980799103fe1bb3d89d4a3c6 Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 16:45:22 +0000 Subject: [PATCH 03/10] using phpinfo on index --- src/index.php | 4 +--- src/other.php | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 src/other.php diff --git a/src/index.php b/src/index.php index a1e063b..147cebc 100644 --- a/src/index.php +++ b/src/index.php @@ -1,3 +1 @@ -"; -?> + diff --git a/src/other.php b/src/other.php new file mode 100644 index 0000000..a1e063b --- /dev/null +++ b/src/other.php @@ -0,0 +1,3 @@ +"; +?> From ba7f097e71b7bd3cca2aa57be9d95c4ef3369d44 Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 16:46:28 +0000 Subject: [PATCH 04/10] correcting readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 244af8e..0defebf 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Setup ``` -docker build -t docker-php-helloworld .` -docker run -p 80:80 docker-php-helloworld` +docker build -t docker-php-helloworld . +docker run -p 80:80 docker-php-helloworld ``` From 3ef54bf35d72130a176e7b0529176334f37c3a29 Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 16:48:31 +0000 Subject: [PATCH 05/10] trying another version from Sebastian@simpli --- Dockerfile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index ccef55c..e670299 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,13 @@ -FROM php:7.0-apache -COPY src/ /var/www/html -EXPOSE 80 +FROM alpine +WORKDIR /app + +COPY src . + +RUN apk add php + +ENTRYPOINT ["php"] + +CMD ["-f","index.php","-S","0.0.0.0:8080"] + +EXPOSE 8080 From 55ac8017d093399fe1e4471bd4fd160d9d465159 Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 12:02:32 -0500 Subject: [PATCH 06/10] pushing git workflow --- .github/workflows/ci.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..5d23bf1 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,26 @@ +--- +name: CI + on: + push: + - dca + jobs: + docker: + runs-on: ubuntu-18.04 + steps: + - + name: checkout + uses: actions/checkout@v2 + + - + name: test + run: | + set -x + docker build -t ramky/docker-php-helloworld:test . + docker run -d --name phpinfo -p 80:8080 ramky/docker-php-helloworld:test + while true + do sleep 10 + docker logs phpinfo | grep "PHP .* Development Server.* started" && break + done + while true + do sleep 10 + curl localhost | grep "PHP.*phpinof()" && break From a91bf4ac8731ded87a3db8850417704f32237cdc Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 12:08:05 -0500 Subject: [PATCH 07/10] trying another version --- .github/workflows/ci.yaml | 46 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5d23bf1..1ea37a4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,26 +1,24 @@ ---- name: CI - on: - push: +on: + push: + branches: - dca - jobs: - docker: - runs-on: ubuntu-18.04 - steps: - - - name: checkout - uses: actions/checkout@v2 - - - - name: test - run: | - set -x - docker build -t ramky/docker-php-helloworld:test . - docker run -d --name phpinfo -p 80:8080 ramky/docker-php-helloworld:test - while true - do sleep 10 - docker logs phpinfo | grep "PHP .* Development Server.* started" && break - done - while true - do sleep 10 - curl localhost | grep "PHP.*phpinof()" && break +jobs: + docker: + runs-on: ubuntu-18.04 + steps: + - name: checkout + uses: actions/checkout@v2 + - name: test + run: | + set -x + docker build -t ramky/docker-php-helloworld:test . + docker run -d --name phpinfo -p 80:8080 ramky/docker-php-helloworld:test + while true + do sleep 10 + docker logs phpinfo | grep "PHP .* Development Server .* started" && break + done + while true + do sleep 10 + curl localhost | grep "PHP.*phpinfo()" && break + done From 6c7ad2a894b965580ecb269b9fb6fa83c59171fa Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 12:08:18 -0500 Subject: [PATCH 08/10] chaning port to 80 --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1ea37a4..b9b6284 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,7 +13,7 @@ jobs: run: | set -x docker build -t ramky/docker-php-helloworld:test . - docker run -d --name phpinfo -p 80:8080 ramky/docker-php-helloworld:test + docker run -d --name phpinfo -p 80:80 ramky/docker-php-helloworld:test while true do sleep 10 docker logs phpinfo | grep "PHP .* Development Server .* started" && break From b617f2a1b6b943f13c9cf077fc19a76bb8870135 Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 12:11:39 -0500 Subject: [PATCH 09/10] changing port --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b9b6284..1ea37a4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,7 +13,7 @@ jobs: run: | set -x docker build -t ramky/docker-php-helloworld:test . - docker run -d --name phpinfo -p 80:80 ramky/docker-php-helloworld:test + docker run -d --name phpinfo -p 80:8080 ramky/docker-php-helloworld:test while true do sleep 10 docker logs phpinfo | grep "PHP .* Development Server .* started" && break From 5ab9c1c19faacc01a96f4005c6a405184b0127a3 Mon Sep 17 00:00:00 2001 From: Ram Iyer Date: Sat, 13 Mar 2021 12:20:13 -0500 Subject: [PATCH 10/10] correcting typo --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1ea37a4..57997a6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,9 +16,9 @@ jobs: docker run -d --name phpinfo -p 80:8080 ramky/docker-php-helloworld:test while true do sleep 10 - docker logs phpinfo | grep "PHP .* Development Server .* started" && break + docker logs phpinfo 2>& 1 | grep 'PHP .* Development Server .* started' && break done while true do sleep 10 - curl localhost | grep "PHP.*phpinfo()" && break + curl -s localhost | grep "PHP.*phpinfo()" && break done