Skip to content

Commit 59a9202

Browse files
committed
optomised dockerfile & updated readme
1 parent 14bffc7 commit 59a9202

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ PHP Extensions:
3232
Build the ***Docker Image*** without using ***cached*** versions of previous image build stages.
3333

3434
```bash
35-
sudo docker build -f php-5-6-apache.Dockerfile --target php-5-6-build --no-cache -t php-5-6-web-server:latest .
35+
sudo docker build \
36+
-f php-5-6-apache.Dockerfile \
37+
--target php-5-6-build \
38+
--no-cache \
39+
-t php-5-6-web-server:latest \
40+
.
3641
```
3742

3843
**N.B.**
@@ -50,15 +55,26 @@ sudo docker build -f php-5-6-apache.Dockerfile --target php-5-6-build --no-cache
5055
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.
5156

5257
```bash
53-
sudo docker run -d --network host -v "$(pwd)"/public_html:/var/www/html --name php-5-6-web-server php-5-6-web-server:latest
58+
sudo docker run \
59+
-d \
60+
--network host \
61+
-v "$(pwd)"/public_html:/var/www/html \
62+
--name php-5-6-web-server \
63+
php-5-6-web-server:latest
5464
```
5565

5666
**OR**
5767

5868
This creates a named container and attaches it to the ***bridge network*** and allows for ***port forward mapping*** from the ***host*** to the ***Container***.
5969

6070
```bash
61-
sudo docker run -d --network bridge -p 8080:80/tcp -v "$(pwd)"/public_html:/var/www/html --name php-5-6-web-server php-5-6-web-server:latest
71+
sudo docker run \
72+
-d \
73+
--network bridge \
74+
-p 8080:80/tcp \
75+
-v "$(pwd)"/public_html:/var/www/html \
76+
--name php-5-6-web-server \
77+
php-5-6-web-server:latest
6278
```
6379

6480
**N.B.**

php-5-6-apache.Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ FROM php:5.6-apache as php-5-6-build
44
LABEL evilwizardcreations.image.authors="evil.wizard95@googlemail.com" \
55
evilwizardcreations.image.php.version="5.6"
66

7-
# Enable some apache modules.
8-
RUN a2enmod rewrite; \
9-
a2enmod headers; \
10-
a2enmod ssl
7+
# copy the specific Composer PHAR version from the Composer image into the PHP image
8+
COPY --from=composer:1.9.3 /usr/bin/composer /usr/bin/composer
119

1210
# Download the nodejs setup & set that it's a docker env.
1311
ENV NODE_ENV docker
1412
RUN curl --silent --location https://deb.nodesource.com/setup_14.x | bash
1513

14+
# Enable some apache modules.
15+
RUN a2enmod rewrite; \
16+
a2enmod headers; \
17+
a2enmod ssl
18+
1619
# Install some extra stuff
1720
RUN set -ex; \
1821
apt-get update; \
@@ -32,6 +35,3 @@ RUN set -ex; \
3235
RUN docker-php-ext-install gettext mysqli pdo_mysql zip
3336
RUN pecl install yaml-1.3.0 && \
3437
docker-php-ext-enable yaml
35-
36-
# 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

0 commit comments

Comments
 (0)