You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-42Lines changed: 49 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,44 +28,71 @@ PHP Extensions:
28
28
- zip
29
29
- yaml
30
30
31
-
## Build Image
31
+
## Build & Compose Up
32
32
33
-
Build the ***Docker Image*** without using ***cached*** versions of previous image build stages.
34
-
35
-
### Helper Script
33
+
Note that the `php-5-6-apache` is the Docker Compose Service to ***Build***.
36
34
37
-
A helper script is available with the repo to force recreate the build & use the `docker-compose.yaml` file which reads the `.env` file.
35
+
There is a build script included that uses the local `.env` file & an [Evil Wizard Creations Protocol](https://bitbucket.org/evilwizardcreations/ewc-protocols) that makes this much simpler.
38
36
39
37
```bash
40
-
./build-web.sh
38
+
build-up-php-7.2-fpm.sh
41
39
```
42
40
43
-
### The long Way
41
+
Alternatively there is the *full Procedure*.
42
+
43
+
1. Build the Image using the `docker-compose-build.yaml` configuration.
1. Compose *Up* using the `docker-compose-build.yaml` configuration will use the new built Image and `-d` to *detach*.
50
+
51
+
```bash
52
+
docker-compose -f ./docker-compose-build.yaml up -d
53
+
```
54
+
55
+
## Build Image The Long Way
56
+
57
+
Build the ***Docker Image*** without using ***cached*** versions of previous image build stages.
58
+
44
59
45
60
```bash
46
61
sudo docker build \
47
62
-f php-5-6-apache.Dockerfile \
48
-
--target php-5-6-build \
63
+
--target build-php-56-apache \
49
64
--build-arg APP_ENV=local \
50
65
--build-arg NPM_VERSION=6.4.1 \
51
66
--no-cache \
52
-
-t php-5-6-web-server:latest \
67
+
-t php-5-6-apache:latest \
53
68
.
54
69
```
55
70
56
71
**N.B.**
57
72
58
73
- Using `-f php-5-6-apache.Dockerfile`
59
74
60
-
To specify the *filename* to ***build*** otherwise it is expected to be named `Dockerfile`.
75
+
To specify `php-5-6-apache.Dockerfile` as the *filename* to ***build*** otherwise it is expected to be named just`Dockerfile`.
61
76
62
-
- Using `--target php-5-6-build`
77
+
- Using `--target build-php-56-apache`
63
78
64
79
To selectthe***build target stage***[^multi_stage_builds_note] from the *Dockerfile*.
80
+
81
+
- Using `--no-cache`
82
+
83
+
To prevent using previous ***cached*** versions of image build stages.
65
84
66
-
- Using `--build-arg ARG=value`
85
+
- Using `--build-arg NPM_VERSION=6.4.1`
86
+
87
+
To set build ***arguments***&***values*** to use during the build process. `NPM_VERSION=6.4.1` sets the ***Node Version*** to be used to ***6.4.1*** when rebuilding the image.
88
+
89
+
- Using `-t php-5-6-apache:latest`
67
90
68
-
To set build argument values to use.
91
+
To ***name***&***tag*** the locally built docker image.
92
+
93
+
- Using `.`
94
+
95
+
To set the current location as the ***build context***for the build process.
69
96
70
97
### Create A Container
71
98
@@ -76,8 +103,8 @@ sudo docker run \
76
103
-d \
77
104
--network host \
78
105
-v "$(pwd)"/public_html:/var/www/html \
79
-
--name php-5-6-web-server \
80
-
php-5-6-web-server:latest
106
+
--name php-5-6-apache \
107
+
php-5-6-apache:latest
81
108
```
82
109
83
110
**OR**
@@ -90,8 +117,8 @@ sudo docker run \
90
117
--network bridge \
91
118
-p 8080:80/tcp \
92
119
-v "$(pwd)"/public_html:/var/www/html \
93
-
--name php-5-6-web-server \
94
-
php-5-6-web-server:latest
120
+
--name php-5-6-apache \
121
+
php-5-6-apache:latest
95
122
```
96
123
97
124
**N.B.**
@@ -104,46 +131,26 @@ sudo docker run \
104
131
105
132
To map port **8080** on the ***Host*** machine to port **80** on the ***Container*** using the ***bridge network***.
106
133
107
-
- Using `--name php-5-6-web-server`
134
+
- Using `--name php-5-6-apache`
108
135
109
136
To name the ***Container*** being created.
110
137
111
138
### Start Container
112
139
113
140
```bash
114
-
sudo docker start php-5-6-web-server
141
+
sudo docker start php-5-6-apache
115
142
```
116
143
117
144
### Stop Container
118
145
119
146
```bash
120
-
sudo docker stop php-5-6-web-server
121
-
```
122
-
123
-
## Docker Compose
124
-
125
-
A `docker-compose` configuration file is included to simplify the build & deployment of the image.
126
-
127
-
### Build - No Cache
128
-
129
-
This is only necessary when completely rebuilding the image to make sure all parts are rebuilt[^compose_name_note].
0 commit comments