×
Inicio Galería Aleatorio Contacto

infraestructura docker para symfony5

Sección: Symfony

Creado: 27-02-21 (Actualizado: 27-02-21)

Infraestructura con docker-compose

# docker-compose.yml
version: '3.8'

services:
    nginx:
        image: nginx
        container_name: nginx
        depends_on: 
            - mariadb
            - php
        volumes:
            - ../sf5:/var/www/sf5
            - ./nginx/conf.d:/etc/nginx/conf.d
            - ./nginx/log:/var/log/nginx
        ports:
            - "80:80"
            - "443:443"
    mariadb:
        image: mariadb:10.5.1
        container_name: mariadb
        command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
        volumes: 
            - ./mysql/data:/var/lib/mysql
            - ./mysql/log:/var/log/mysql
        environment:
            MYSQL_ROOT_PASSWORD: main
        ports: [3306:3306]
    adminer:
        image: adminer
        container_name: adminer
        environment:
            ADMINER_DEFAULT_SERVER: mariadb
        ports:
            - 8080:8080
    redis:
        image: redis:5-alpine
        container_name: redis
        ports: [6379:6379]
    php:
        build: ./php
        container_name: php
        working_dir: /var/www/sf5
        volumes:
            - ../sf5:/var/www/sf5            
            - /var/www/sf5/node_modules
            - ./php/custom.ini:/etc/php/7.4/fpm/conf.d/custom.ini
            - ./php/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
            - ~/.ssh/:/root/.ssh/
        env_file:
            - .env
    # php:
    #     image: php:7.4-fpm-alpine
    #     container_name: php-fpm
    #     volumes:
    #         - ../sf5:/var/www/sf5
    #         - ./php-fpm/custom.ini:/etc/php/7.4/fpm/conf.d/custom.ini
    #         - ./php-fpm/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
docker-compose up -d
docker-compose stop

Siguiente Publicación