Skip to content

Commit c37df9e

Browse files
authored
Merge pull request #546 from TimWolla/improve-docker-instructions
Improve Docker instructions in docs/usage.md
2 parents 09b665b + 3252bbc commit c37df9e

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

docs/usage.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ curl -fL --output /tmp/pie.phar https://github.com/php/pie/releases/latest/downl
3333

3434
### Docker installation
3535

36-
PIE is published as binary-only Docker image, so you can install it easily during your Docker build:
36+
PIE is published as binary-only Docker image, so you can use it easily during your Docker build:
3737

3838
```Dockerfile
39-
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
39+
RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie \
40+
pie -V
4041
```
4142

4243
Instead of `bin` tag (which represents latest binary-only image) you can also use explicit version (in `x.y.z-bin` format). Use [GitHub registry](https://ghcr.io/php/pie) to find available tags.
@@ -54,17 +55,20 @@ installed.
5455
```Dockerfile
5556
FROM php:8.4-cli
5657

57-
# Add the `unzip` package which PIE uses to extract .zip files
58-
RUN export DEBIAN_FRONTEND="noninteractive"; \
58+
RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie \
59+
export DEBIAN_FRONTEND="noninteractive"; \
5960
set -eux; \
60-
apt-get update; apt-get install -y --no-install-recommends unzip; \
61-
rm -rf /var/lib/apt/lists/*
61+
# Add the `unzip` package which PIE uses to extract .zip files.
62+
apt-get update; \
63+
apt-get install -y --no-install-recommends unzip; \
64+
# Use PIE to install an extension...
65+
pie install asgrim/example-pie-extension; \
66+
# Clean up `unzip`.
67+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false unzip; \
68+
rm -rf /var/lib/apt/lists/*;
6269

63-
# Copy the pie.phar from the latest `:bin` release
64-
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
6570

66-
# Use PIE to install an extension...
67-
RUN pie install asgrim/example-pie-extension
71+
CMD ["php", "-r", "example_pie_extension_test();"]
6872
```
6973

7074
If the extension you would like to install needs additional libraries or other

0 commit comments

Comments
 (0)