Skip to content

Instantly share code, notes, and snippets.

@ypereirareis
Last active October 28, 2019 14:18
Show Gist options
  • Save ypereirareis/2aa1fbc62d31088bf3845d6beb3a109e to your computer and use it in GitHub Desktop.
Save ypereirareis/2aa1fbc62d31088bf3845d6beb3a109e to your computer and use it in GitHub Desktop.
Split env file into multiple files
REGISTRY_PATH=registry.domain.tld
TAG_PHP=7.2
TAG_NGINX=1.17.5
HTTP_PORT=2000
REPLICA_COUNT_PHP=3
REPLICA_COUNT_NGINX=3
DATABASE_NETWORK=mysql-005
NGINX_MEM_LIMIT=215M
PHP_MEM_LIMIT=2G
MEMORY_LIMIT=2G
HOSTNAME=domain.tld
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=test
DB_USER=root
DB_PASSWORD=very_sensitive_password
version: '3.5'
services:
# Php service configuration
php:
image: ${REGISTRY_PATH}/php:${TAG_PHP}
env_file: .env
networks:
- default
- database
deploy:
replicas: ${REPLICA_COUNT_PHP:-1}
resources:
limits:
memory: "${PHP_MEM_LIMIT:-1G}"
# Nginx service configuration
nginx:
image: ${REGISTRY_PATH}/nginx:${TAG_NGINX}
env_file: .env
networks:
- default
ports:
- ${HTTP_PORT}:80
deploy:
replicas: ${REPLICA_COUNT_NGINX:-1}
resources:
limits:
memory: "${NGINX_MEM_LIMIT:-1G}"
networks:
default:
# The database network is external because used by many docker stacks
database:
external: true
name: "${DATABASE_NETWORK}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment