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
Pick between the various [images provided in this repository][images].
33
+
34
+
**(Optionally) Install the Shortcuts:**
35
+
36
+
To use the Docker images more like binaries, we're providing [Shortcuts][shortcuts] that can easily be [installed on your system][install-the-shortcuts].
$ docker run jestefane/php-dev:7.2-cli-1.1.0 hello-world.php
62
+
63
+
# or using one of the provided shortcuts
64
+
$ php-7.2-cli hello-world.php
43
65
```
44
66
45
-
For example:
67
+
## Shortcuts
68
+
69
+
> **Note**: Only tested on some distros of Linux and Mac OS. But hey! It's tested ;)
46
70
47
-
```shell
48
-
docker run --rm -it -w=/app -v $(pwd):/app jestefane/php-dev:7.2-cli-1.1.0 hello-world.php
71
+
Shortcuts are simple `bash` scripts wrapping the `docker` command that facilitate command-line-use of the images in this repository.
72
+
73
+
### Install the Shortcuts
74
+
75
+
From the root of this directory:
76
+
77
+
```sh
78
+
# If you haven't done so, clone this repository
79
+
$ git clone https://github.com/grimzy/php-dev.git
80
+
81
+
# Get in there!
82
+
# Yes, you have to! the script doesn't always work when running from outside
83
+
$ cd php-dev
84
+
85
+
# Generate the scripts and install the shortcuts
86
+
make shortcuts
49
87
```
50
88
51
-
### Composer
89
+
This generates `bash` scripts in the `scripts` directory (via. [Script Template][templates]). It also adds them to your `PATH` environment variable (Linux and Mac OS only) by creating symlinks of the generated `bash` scripts inside `/usr/local/bin`.
90
+
91
+
For more info on the `shortcuts` task, please checkout the [Makefile command reference][shortcuts-make].
92
+
93
+
#### Script Templates
52
94
53
-
```shell
54
-
docker run --rm -it \
55
-
-w=/app \
56
-
-v /path/to/project:/app \
57
-
-v ~/.ssh:/root/.ssh \
58
-
-v $HOME/.composer-docker:/root/.composer \
59
-
jestefane/php-dev:7.2-cli-1.1.0 composer
95
+
You'll notice that the directory that should contain the scripts doesn't exist; that's because you first need to generate them. This is automatically done prior to creating the symlinks. But if you've deleted a script or changed the templates in some way, you can regenerate scripts with:
96
+
97
+
```sh
98
+
# Removes the scripts directory and generates them back
99
+
$ make scripts
60
100
```
61
101
62
-
For example:
102
+
For more info on the `scripts` task [Makefile command reference][scripts-make].
103
+
104
+
### Shortcuts Reference
105
+
106
+
#### PHP CLI
107
+
108
+
**Images**: [All respective versions of the PHP CLI variant][cli]
|`SOURCE_BRANCH`| Appended to the image name | Repository's current version: `1.1.0`| Any `string` value |
129
+
|`PHP_VERSIONS`| Space separated list of PHP versions to perform a task on |`5.5 5.6 7.0 7.1 7.2`| Any combination from `5.5`, `5.6`, `7.0`, `7.1`, `7.2`|
130
+
|`PHP_VARIANTS`| Space separated list of Docker build variants to perform a task on |`cli`|`cli`|
131
+
|`BIN_DIR`| Directory in your `PATH` where you would like to symlink the scripts |`/usr/local/bin`| Any path on your system. Preferaby one already in your `PATH`|
132
+
|`SCRIPTS_DIR`| Directory where the scripts are generated (or removed). Relative to the repository's root |`scripts`| Any path on your system |
133
+
134
+
> **Note**: When overriding space separated values from the CLI, you have to escape spaces. For example in `bash` you use `\`:
135
+
>
136
+
> ```sh
137
+
> $ make build PHP_VERSIONS=7.0\ 7.1\ 7.2
138
+
>```
139
+
140
+
### Tasks
141
+
142
+
#### Build the Images
143
+
144
+
Locally builds all images from all possible combinations of `PHP_VERSIONS` and `PHP_VARIANTS`. `SOURCE_BRANCH` is appended to the image name.
145
+
146
+
**Command:**
147
+
148
+
```sh
149
+
$ make build [PHP_VERSIONS=] [PHP_VARIANTS=] [SOURCE_BRANCH=]
150
+
```
151
+
152
+
#### Remove the Images
153
+
154
+
Remove all locally cached images from all possible combinations of `PHP_VERSIONS` and `PHP_VARIANTS`.
155
+
156
+
**Command:**
157
+
158
+
```sh
159
+
$ make rm_build [PHP_VERSIONS=] [PHP_VARIANTS=] [SOURCE_BRANCH=]
71
160
```
72
161
73
-
## Scripts
162
+
#### Rebuild the Images
163
+
164
+
Alias for removing then building the images: `make rm_build build`.
74
165
75
-
So you don't have to type the full docker run commands, you can generate shell scripts that alias th
166
+
#### Generate the Scripts
76
167
77
-
```shell
78
-
make install_scripts # adds symlinks in /usr/local/bin
168
+
Generate the `bash` scripts from [templates][templates] in the `template` directory. Generated scripts are saved in the `SCRIPTS_DIR` directory. The `PHP_VERSION``PHP_VARIANT` and `SOURCE_BRANCH` are passed to the [templates][templates].
169
+
170
+
**Command:**
171
+
172
+
This task first runs: `rm_scripts_dir`
173
+
174
+
```sh
175
+
$ make scripts [PHP_VERSIONS=] [PHP_VARIANTS=] [SOURCE_BRANCH=] [SCRIPTS_DIR=]
79
176
```
80
177
81
-
> The default is to create symlinks of the scripts inside `/usr/local/bin`. If you'd like to override that, run `make install_scripts BIN_DIR=/dir/of/your/choice`
178
+
#### Remove the Generated Scripts Directory
82
179
83
-
## Building Images Locally
180
+
Removes the `SCRIPTS_DIR` directory.
84
181
85
-
```shell
86
-
$ make build
182
+
**Command:**
183
+
184
+
```sh
185
+
$ make rm_scripts_dir [SCRIPTS_DIR=]
87
186
```
88
187
188
+
#### Create the Shortcuts
89
189
190
+
> **Note**: Linux and Mac OS only
90
191
91
-
## Rebuilding Scripts from Templates
192
+
This task creates symlinks of the scripts inside of `SCRIPTS_DIR` inside of the `BIN_DIR`. This adds them to your `PATH` environment variable (Linux and Mac OS only) easily making them available for use on your command line.
92
193
93
-
```shell
94
-
make scripts
194
+
**Command:**
195
+
196
+
```sh
197
+
$ make shortcuts [SCRIPTS_DIR=] [BIN_DIR=]
95
198
```
96
199
97
-
## Adding a new PHP version
200
+
**Before run:**`make scripts`
98
201
99
-
In Makefile, add the new version to `VERSIONS`. Then run
202
+
#### Remove the Shortcuts
100
203
101
-
```shell
102
-
make builds
204
+
This task removes this repository's scripts' symlinks from the `BIN_DIR`.
205
+
206
+
**Command:**
207
+
208
+
```sh
209
+
$ make rm_shortcuts [PHP_VERSIONS=] [PHP_VARIANTS=] [BIN_DIR=]
103
210
```
104
211
105
-
or run:
212
+
#### Remove Dangling Volumes and Images
213
+
214
+
> **Warning**: Running this task will remove **any** dangling volume and image on your system; not just the ones provided.
0 commit comments