Switch from nginx to Apache
So I can use a .htaccess file for wildcard redirects.
This commit is contained in:
parent
19c77678fb
commit
29c2d595ae
|
@ -5,7 +5,7 @@ export DOCKER_UID=1000
|
|||
export COMPOSE_PROJECT_NAME=oliverdavies-uk
|
||||
export COMPOSE_PROFILES=web,php,database
|
||||
|
||||
export DOCKER_WEB_VOLUME=.:/app
|
||||
export DOCKER_WEB_VOLUME=.:/var/www/html
|
||||
|
||||
export MYSQL_DATABASE=app
|
||||
export MYSQL_PASSWORD=app
|
||||
|
|
20
Dockerfile
20
Dockerfile
|
@ -1,6 +1,6 @@
|
|||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||
|
||||
FROM php:8.2-fpm-bullseye AS base
|
||||
FROM php:8.2-apache AS base
|
||||
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
RUN which composer && composer -V
|
||||
|
@ -8,14 +8,14 @@ RUN which composer && composer -V
|
|||
ARG DOCKER_UID=1000
|
||||
ENV DOCKER_UID="${DOCKER_UID}"
|
||||
|
||||
WORKDIR /app
|
||||
WORKDIR /var/www/html
|
||||
|
||||
RUN adduser --disabled-password --uid "${DOCKER_UID}" app \
|
||||
&& chown app:app -R /app
|
||||
&& chown app:app -R /var/www/html
|
||||
|
||||
USER app
|
||||
|
||||
ENV PATH="${PATH}:/app/bin:/app/vendor/bin"
|
||||
ENV PATH="${PATH}:/var/www/html/bin:/var/www/html/vendor/bin"
|
||||
|
||||
COPY --chown=app:app composer.* ./
|
||||
|
||||
|
@ -25,6 +25,7 @@ FROM base AS build
|
|||
|
||||
USER root
|
||||
|
||||
RUN a2enmod rewrite
|
||||
|
||||
RUN apt-get update -yqq \
|
||||
&& apt-get install -yqq --no-install-recommends \
|
||||
|
@ -48,17 +49,8 @@ RUN composer install --quiet --no-progress
|
|||
COPY --chown=app:app tools/docker/images/php/root /
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-php"]
|
||||
CMD ["php-fpm"]
|
||||
CMD ["apache2-foreground"]
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
FROM nginx:1 as web
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY tools/docker/images/web/root /
|
||||
|
|
|
@ -2,8 +2,10 @@ name: oliverdavies-uk
|
|||
type: drupal
|
||||
language: php
|
||||
|
||||
project_root: /var/www/html
|
||||
|
||||
web:
|
||||
type: nginx
|
||||
type: apache
|
||||
|
||||
database:
|
||||
type: mariadb
|
||||
|
@ -11,7 +13,7 @@ database:
|
|||
extra_databases: []
|
||||
|
||||
php:
|
||||
version: 8.2-fpm-bullseye
|
||||
version: 8.2-apache
|
||||
phpcs:
|
||||
paths:
|
||||
- web/modules/custom
|
||||
|
@ -29,7 +31,6 @@ docker-compose:
|
|||
services:
|
||||
- database
|
||||
- php
|
||||
- web
|
||||
|
||||
dockerfile:
|
||||
stages:
|
||||
|
|
|
@ -12,7 +12,7 @@ x-proxy: &default-proxy
|
|||
|
||||
x-app: &default-app
|
||||
volumes:
|
||||
- "${DOCKER_WEB_VOLUME:-./web:/app/web}"
|
||||
- "${DOCKER_WEB_VOLUME:-./web:/var/www/html/web}"
|
||||
env_file:
|
||||
- .env
|
||||
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
|
||||
|
@ -28,24 +28,16 @@ x-app: &default-app
|
|||
tty: true
|
||||
|
||||
services:
|
||||
web:
|
||||
<<: [*default-proxy, *default-app]
|
||||
build:
|
||||
context: .
|
||||
target: web
|
||||
depends_on:
|
||||
- php
|
||||
profiles: [web]
|
||||
|
||||
php:
|
||||
<<: [*default-app]
|
||||
<<: [*default-proxy, *default-app]
|
||||
build:
|
||||
context: .
|
||||
target: build
|
||||
args:
|
||||
- "DOCKER_UID=${DOCKER_UID:-1000}"
|
||||
volumes:
|
||||
- .:/app
|
||||
- .:/var/www/html
|
||||
depends_on:
|
||||
- database
|
||||
profiles: [php]
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||
|
||||
<VirtualHost *:80>
|
||||
DocumentRoot /var/www/html/web
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</VirtualHost>
|
|
@ -1,22 +0,0 @@
|
|||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||
|
||||
server {
|
||||
server_name _;
|
||||
|
||||
root /app/web;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
|
||||
try_files $fastcgi_script_name =404;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_pass php:9000;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue