Add local environment with Docker Compose

This commit is contained in:
Oliver Davies 2021-02-09 14:37:50 +00:00
parent f764004f89
commit d8a1616481
5 changed files with 115 additions and 0 deletions

7
.dockerignore Normal file
View file

@ -0,0 +1,7 @@
/**/*.{md,txt}
/.git-blame-ignore-revs
/.git/
/.github/
/.gitignore
/.idea/
/.notes/

52
docker-compose.yaml Normal file
View file

@ -0,0 +1,52 @@
version: '2.4'
networks:
public:
external:
name: traefik_proxy
volumes:
node_modules: ~
services:
nginx:
image: nginx:1
working_dir: /app
volumes:
- ./:/app
- ./tools/docker/images/nginx/configs/vhost.conf:/etc/nginx/conf.d/default.conf
# ports:
# - 9000:80
depends_on:
node:
condition: service_started
php:
condition: service_started
networks:
default: {}
public: {}
labels:
- traefik.docker.network=traefik_proxy
- traefik.enable=true
- traefik.http.routers.workshop-tailwind.rule=Host(`workshop-tailwind.docker.localhost`)
php:
build:
context: .
dockerfile: tools/docker/Dockerfile
target: dev
volumes:
- ./:/app
networks:
default: {}
labels:
- "traefik.enable=false"
node:
image: node:12
working_dir: /node/app
volumes:
- .:/node/app
- node_modules:/node/app/node_modules
labels:
- "traefik.enabled=false"

35
tools/docker/Dockerfile Normal file
View file

@ -0,0 +1,35 @@
fROM php:7.3-fpm-buster AS base
RUN apt update -yqq && apt install -yqq \
git \
libpng-dev \
mariadb-client \
zip \
zlib1g-dev \
&& docker-php-ext-install \
exif \
gd \
pdo_mysql
###
FROM base AS dev
WORKDIR /app
ENV PATH="./bin:./vendor/bin:$PATH"
RUN apt update -yqq \
&& apt install -yqq \
pv \
vim \
&& pecl install xdebug-2.9.0 \
&& docker-php-ext-enable xdebug
COPY --from=composer:1 /usr/bin/composer /usr/bin/composer
COPY composer.json composer.lock /app/
COPY assets /app/assets
RUN composer install
COPY tools/docker/images/php/configs/php.ini /usr/local/etc/php/conf.d/php.ini

View file

@ -0,0 +1,19 @@
server {
server_name _;
root /app/public;
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;
}
}

View file

@ -0,0 +1,2 @@
date.timezone=UTC
expose_php=Off