Skip to content

Instantly share code, notes, and snippets.

@ajdinmore
Last active August 24, 2022 17:02
Show Gist options
  • Save ajdinmore/7fc11cd6fe2fa885faa7280dfd44edbf to your computer and use it in GitHub Desktop.
Save ajdinmore/7fc11cd6fe2fa885faa7280dfd44edbf to your computer and use it in GitHub Desktop.
Quick-start PHP project Docker setup
version: '3.8'
services:
php:
image: ajdinmore/php:8.1-dev
hostname: php
tty: true
volumes:
- ./:/app
- ${COMPOSER_HOME:-~/.composer}:/composer
environment:
DATABASE_URL: postgresql://db_user:db_password@db:5432/db_name?serverVersion=14&charset=utf8
nginx:
image: ajdinmore/nginx
hostname: nginx
tty: true
depends_on:
- php
volumes:
- ./:/app
ports:
- ${COMPOSE_HTTP_PORT:-80}:80
db:
image: postgres:14-alpine
hostname: db
tty: true
volumes:
- .data/db:/var/lib/postgresql/data/pgdata
ports:
- ${COMPOSE_DB_PORT:-5432}:5432
environment:
POSTGRES_DB: db_name
POSTGRES_USER: db_user
POSTGRES_PASSWORD: db_password
PGDATA: /var/lib/postgresql/data/pgdata
node:
image: node:18-alpine
hostname: node
tty: true
working_dir: /app
user: ${COMPOSE_USER:-root:root}
command: bash -c 'npm install && npm run dev-server'
volumes:
- ./:/app
ports:
- ${COMPOSE_WEBPACK_PORT:-8080}:${COMPOSE_WEBPACK_PORT:-8080}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment