name: inmuebles-patrimoniales

services:
    migrate:
        build:
            context: .
            dockerfile: Dockerfile
            target: production
        env_file:
            - .env
        environment:
            APP_ENV: production
            APP_DEBUG: "false"
            QUEUE_CONNECTION: sync
        command: ["php", "artisan", "migrate", "--force"]
        restart: "no"
        networks:
            - internal
        #    - dokploy-network

    app:
        build:
            context: .
            dockerfile: Dockerfile
            target: production
        restart: unless-stopped
        env_file:
            - .env
        environment:
            APP_ENV: production
            APP_DEBUG: "false"
            QUEUE_CONNECTION: sync
            SERVER_NAME: ":80"
            SERVER_ROOT: public/
        volumes:
            - laravel_storage:/app/storage
        ports:
            - "8000:80"
        networks:
            - internal
        #     - dokploy-network
        depends_on:
            migrate:
                condition: service_completed_successfully
        healthcheck:
            test: ["CMD", "php", "-r", "exit(@file_get_contents('http://127.0.0.1/up') === false ? 1 : 0);"]
            interval: 30s
            timeout: 5s
            retries: 3
            start_period: 30s

volumes:
    laravel_storage:

networks:
    internal:
        driver: bridge

    # dokploy-network:
    #     external: true
