Skip to content

Dca #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 0 additions & 11 deletions .circleci/config.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI
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 2>& 1 | grep 'PHP .* Development Server .* started' && break
done
while true
do sleep 10
curl -s localhost | grep "PHP.*phpinfo()" && break
done
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
26 changes: 5 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -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!"
8 changes: 1 addition & 7 deletions src/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
<?php

echo "Hello, World from Docker! <br>";
echo "Hello ECS! <br>";
echo '<img src="https://www.docker.com/sites/default/files/horizontal.png">';

?>
<?php phpinfo(); ?>
3 changes: 3 additions & 0 deletions src/other.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
echo "Hello, World from Docker! <br>";
?>