-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from shyim/add-fpm-base-image
feat: add nginx base image
- Loading branch information
Showing
13 changed files
with
158 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# runtime dependencies | ||
FROM ghcr.io/shyim/wolfi-php/nginx:8.2 as base | ||
ENV APP_ENV=prod | ||
|
||
RUN apk add --no-cache \ | ||
php-8.2-intl \ | ||
php-8.2-simplexml \ | ||
php-8.2-iconv \ | ||
php-8.2-dom \ | ||
php-8.2-xml \ | ||
php-8.2-simplexml \ | ||
php-8.2-pdo \ | ||
php-8.2-pdo_sqlite | ||
|
||
# download symfony demo and build it | ||
FROM base as composer | ||
|
||
RUN apk add --no-cache \ | ||
git \ | ||
composer \ | ||
unzip \ | ||
php-8.2 \ | ||
php-8.2-curl \ | ||
php-8.2-openssl \ | ||
php-8.2-phar | ||
|
||
WORKDIR /app | ||
RUN git clone https://github.com/symfony/demo.git --depth=1 . | ||
RUN composer install | ||
RUN bin/console asset-map:compile | ||
RUN rm -rf .git | ||
|
||
# build final image | ||
|
||
FROM base | ||
|
||
# uid 82 is www-data | ||
COPY --from=composer --chown=82 /app /var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Symfony Demo with Nginx | ||
|
||
This is a Dockerfile to set up a Symfony Demo application with Nginx. | ||
|
||
This example is using this [Nginx image](../../images/nginx/). | ||
|
||
```bash | ||
docker build -t symfony-demo . | ||
docker run -p 8000:8000 symfony-demo | ||
``` | ||
|
||
and then open http://localhost:8000 in your browser. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ARG PHP_VERSION=8.3 | ||
FROM ghcr.io/shyim/wolfi-php/fpm:${PHP_VERSION} | ||
|
||
ENV PHP_FPM_LISTEN=/tmp/php-fpm.sock | ||
|
||
RUN <<EOF | ||
set -eo pipefail | ||
apk add --no-cache \ | ||
overmind \ | ||
nginx | ||
EOF | ||
|
||
COPY --link rootfs / | ||
EXPOSE 8000 | ||
|
||
ENTRYPOINT ["/usr/bin/overmind", "start", "-f", "/etc/Procfile", "-s", "/tmp/overmind.sock"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Nginx + PHP-FPM | ||
|
||
This image contains Nginx and PHP-FPM in the same container. To run both processes in the same container, we use overmind a Procfile compatible process manager. | ||
|
||
## Usage | ||
|
||
```dockerfile | ||
FROM ghcr.io/shyim/wolfi-php/fpm:8.3 | ||
|
||
# Install missing extensions | ||
RUN apk add --no-cache php-8.3-redis php-8.3-gd | ||
|
||
# Copy your files | ||
COPY . /var/www/html | ||
``` | ||
|
||
```shell | ||
docker build -t my-image . | ||
docker run -p 8080:8080 my-image | ||
``` | ||
|
||
You can run it for testing purposes also directly, `docker run --rm -p 8080:8080 ghcr.io/shyim/wolfi-php/fpm:8.3` and you should see at `http://localhost:8000` the php info page. | ||
|
||
## PHP Extensions / PHP Configuration | ||
|
||
As this image bases on [fpm](../fpm/), you can check out there how to configure PHP / PHP-FPM and install php extensions. | ||
|
||
## Overwrite Nginx Configuration | ||
|
||
You can overwrite the Nginx configuration by copying your own configuration to `/etc/nginx/nginx.conf`: | ||
|
||
```dockerfile | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
``` | ||
|
||
You can find the default configuration [here](./rootfs/etc/nginx/nginx.conf). | ||
|
||
## Running rootless | ||
|
||
You can run the container as a non-root user. The image has a user `www-data` with UID 82. You can use it like this: | ||
|
||
```dockerfile | ||
USER www-data | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.