Skip to content

Instantly share code, notes, and snippets.

@wgriffioen
Created October 8, 2019 20:41
Show Gist options
  • Save wgriffioen/c4dbcb95959cc0d780d3638ee8f2cb9e to your computer and use it in GitHub Desktop.
Save wgriffioen/c4dbcb95959cc0d780d3638ee8f2cb9e to your computer and use it in GitHub Desktop.
FROM php:7.3-fpm-alpine
ENV COMPOSER_HOME /composer
ENV PATH /composer/vendor/bin:$PATH
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN apk add --no-cache $PHPIZE_DEPS postgresql-dev curl \
&& pecl install xdebug-2.7.2 redis \
&& docker-php-ext-enable xdebug redis\
&& docker-php-ext-install pdo_pgsql pcntl \
&& rm -rf /tmp/pear
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php --install-dir=/usr/bin --filename=composer \
php -r "unlink('composer-setup.php');"
version: '3'
services:
app:
build:
context: ./docker
dockerfile: app.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www:delegated
environment:
- "LOG_CHANNEL=stderr"
- "DB_PORT=5432"
- "DB_HOST=database"
- "DB_USERNAME=postgres"
- "DB_DATABASE=website"
- "DB_PASSWORD=secret"
- "REDIS_HOST=redis"
worker:
build:
context: ./docker
dockerfile: app.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www:delegated
environment:
- "LOG_CHANNEL=stderr"
- "DB_PORT=5432"
- "DB_HOST=database"
- "DB_USERNAME=postgres"
- "DB_DATABASE=website"
- "DB_PASSWORD=secret"
- "REDIS_HOST=redis"
restart: unless-stopped
command: php artisan horizon
web:
image: nginx:alpine
depends_on:
- app
working_dir: /var/www
volumes:
- ./:/var/www
- ./docker/nginx/vhost.conf:/etc/nginx/conf.d/default.conf
ports:
- 8000:80
database:
image: postgres:12-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- "POSTGRES_PASSWORD=secret"
- "POSTGRES_DB=website"
ports:
- 54321:5432
yarn:
image: node:alpine
working_dir: /app
volumes:
- ./:/app
command: yarn run watch
redis:
image: redis:alpine
volumes:
- redis_data:/data
ports:
- 6379:6379
volumes:
postgres_data:
redis_data:
server {
listen 80;
index index.php index.html;
root /var/www/public;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment