Skip to content

Instantly share code, notes, and snippets.

@DfKimera
Created May 20, 2023 10:55
Show Gist options
  • Save DfKimera/e6e5397bb544fda9af912b9f64d02d5e to your computer and use it in GitHub Desktop.
Save DfKimera/e6e5397bb544fda9af912b9f64d02d5e to your computer and use it in GitHub Desktop.
version: "3.7"
services:
app:
build:
args:
user: sapphire
uid: 1000
context: ./
dockerfile: Dockerfile
image: sapphire
extra_hosts:
- 'sapphire.test:host-gateway'
container_name: sapphire
restart: unless-stopped
working_dir: /var/www/
volumes:
- ./:/var/www
networks:
- sapphire
requires:
- db
- redis
db:
image: mysql:8.0
container_name: sapphire-db
restart: unless-stopped
environment:
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_USER: ${DB_USERNAME}
SERVICE_TAGS: dev
SERVICE_NAME: mysql
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
volumes:
- 'sapphire-mysql:/var/lib/mysql'
- ./docker/mysql:/docker-entrypoint-initdb.d
networks:
- sapphire
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}" ]
retries: 3
timeout: 5s
nginx:
image: nginx:alpine
container_name: sapphire-nginx
restart: unless-stopped
ports:
- 8000:80
volumes:
- ./:/var/www
- ./docker/nginx:/etc/nginx/conf.d/
networks:
- sapphire
redis:
image: 'redis:alpine'
ports:
- '${FORWARD_REDIS_PORT:-6379}:6379'
volumes:
- 'sapphire-redis:/data'
networks:
- sapphire
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
retries: 3
timeout: 5s
networks:
sapphire:
driver: bridge
volumes:
sapphire-mysql:
driver: local
sapphire-redis:
driver: local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment