Skip to content

Commit

Permalink
Merge pull request #1 from mill-hill-automation/env_abspath
Browse files Browse the repository at this point in the history
Added PUBLIC_DIR argument to customise `web` directory
  • Loading branch information
Patabugen authored Dec 23, 2022
2 parents 8d29576 + d1bc894 commit f09e5d6
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 3 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ By default, MySQL and Mailhog containers will be attached, but you can also use,
wp sail:install --with=mysql,mailhog,redis
```

## PHP Versions
At this point, you may want to change the version of PHP used in the `docker-compose.yml` file.

```
Expand All @@ -54,6 +55,21 @@ services:
# ...
```

## Alternative Public Path
If your WordPress files are in a `web/` directory in your repository then you're good to go - otherwise set the PUBLIC_DIR arg in `docker-compose.yaml`.

```
version: '3'
services:
wordpress.test:
build:
context: ./vendor/sterner-stuff/wordpress-sail/runtimes/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
PUBLIC_DIR: 'public' <-- path to the directory containing wp-config.php relative to your docker-compose.yaml file
# ...
```
Finally, build your containers:

```
Expand Down
2 changes: 2 additions & 0 deletions runtimes/7.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ LABEL maintainer="Taylor Otwell"

ARG WWWGROUP
ARG NODE_VERSION=16
ARG PUBLIC_DIR=web

WORKDIR /var/www/html

ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
ENV ABSPATH "/var/www/html/$PUBLIC_DIR"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Expand Down
2 changes: 1 addition & 1 deletion runtimes/7.4/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

[program:php]
command=wp server --docroot=/var/www/html/web/ --host=0.0.0.0 --port=80
command=wp server --docroot=%(ENV_ABSPATH)s --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
Expand Down
2 changes: 2 additions & 0 deletions runtimes/8.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ LABEL maintainer="Taylor Otwell"

ARG WWWGROUP
ARG NODE_VERSION=16
ARG PUBLIC_DIR=web

WORKDIR /var/www/html

ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
ENV ABSPATH "/var/www/html/$PUBLIC_DIR"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Expand Down
2 changes: 1 addition & 1 deletion runtimes/8.0/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

[program:php]
command=wp server --docroot=/var/www/html/web/ --host=0.0.0.0 --port=80
command=wp server --docroot=%(ENV_ABSPATH)s --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
Expand Down
2 changes: 2 additions & 0 deletions runtimes/8.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ LABEL maintainer="Taylor Otwell"

ARG WWWGROUP
ARG NODE_VERSION=16
ARG PUBLIC_DIR=web

WORKDIR /var/www/html

ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
ENV ABSPATH "/var/www/html/$PUBLIC_DIR"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Expand Down
2 changes: 1 addition & 1 deletion runtimes/8.1/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

[program:php]
command=wp server --docroot=/var/www/html/web/ --host=0.0.0.0 --port=80
command=wp server --docroot=%(ENV_ABSPATH)s --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
Expand Down

0 comments on commit f09e5d6

Please sign in to comment.