Skip to content

Commit d9c87d8

Browse files
committed
checked & tested to run from documentation
1 parent 37128f0 commit d9c87d8

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

.env-example

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
APP_PORT=8082
1+
APP_ENV=local
2+
APP_PORT=8080
23
APP_PORT_SSL=8043

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.env
2+
.env.backup
3+
.env.production
4+
/.vscode

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,28 @@ PHP Extensions:
3131

3232
Build the ***Docker Image*** without using ***cached*** versions of previous image build stages.
3333

34+
**N.B.**
35+
36+
This ***requires*** that the file be named `Dockerfile` and nothing else unless specified with the `-f php-5-6-apache.Dockerfile`.
37+
3438
```bash
35-
sudo docker build --target build --no-cache -t php-5-6-web-server .
39+
sudo docker build -f php-5-6-apache.Dockerfile --target php-5-6-build --no-cache -t php-5-6-web-server:latest .
3640
```
3741

3842
### Create A Container
3943

4044
This creates a named container and attaches it to the ***host network*** and may cause port conflict if the host machine is already listening on any exposed ports from the ***Docker Image*** being used.
4145

4246
```bash
43-
sudo docker run -d --network host --name container-name php-5-6-web-server
47+
sudo docker run -d --network host -v "$(pwd)"/public_html:/var/www/html --name container-name php-5-6-web-server
4448
```
4549

4650
**OR**
4751

4852
This creates a named container and attaches it to the ***bridge network*** and allows for ***port forward mapping*** from the ***host*** to the ***Container***. The ports are mapped **8080** on the ***Host*** machine to port **80** on the ***Container***
4953

5054
```bash
51-
sudo docker run -d --network bridge --expose 8080:80 --name container-name php-5-6-web-server
55+
sudo docker run -d --network bridge -p 8080:80/tcp -v "$(pwd)"/public_html:/var/www/html --name container-name php-5-6-web-server
5256
```
5357

5458
### Start Container

docker-compose.yaml

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
1-
version: '3.4'
1+
version: '3.7'
22

33
services:
44
php-5-6-web-server:
5+
container_name: php-5-6-web-server
6+
tty: true
7+
restart: unless-stopped
58
build:
69
context: .
10+
target: php-5-6-build
711
dockerfile: php-5-6-apache.Dockerfile
12+
args:
13+
- APP_ENV=${APP_ENV}
814
labels:
915
ewc.name: "Web Server"
1016
ewc.description: "PHP & Apache Web Server"
1117
ewc.php.version: "5.6"
1218
ewc.label-with-empty-value: ""
1319
image: ewc2020/web:php-5-6-apache
14-
container_name: php-5-6-web-server
20+
environment:
21+
- APP_ENV=${APP_ENV}
22+
- APP_PORT=${APP_PORT}
23+
- APP_PORT_SSL=${APP_PORT_SSL}
24+
working_dir: /var/www
1525
ports:
1626
- ${APP_PORT}:80
1727
- ${APP_PORT_SSL}:443

php-5-6-apache.Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:5.6-apache
1+
FROM php:5.6-apache as php-5-6-build
22

33
# Set some image labels
44
LABEL evilwizardcreations.image.authors="evil.wizard95@googlemail.com" \
@@ -34,4 +34,4 @@ RUN pecl install yaml-1.3.0 && \
3434
docker-php-ext-enable yaml
3535

3636
# copy the specific Composer PHAR version from the Composer image into the PHP image
37-
COPY --from=composer:1.9.3 /usr/bin/composer /usr/bin/composer
37+
COPY --from=composer:1.9.3 /usr/bin/composer /usr/bin/composer

0 commit comments

Comments
 (0)