services: web: image: ldhagen/ksat-weather-app:latest ports: - "8085:80" environment: - TZ=America/Chicago - DB_HOST=db - DB_NAME=weather_db - DB_USER=weather_user - DB_PASS=weather_pass volumes: - ./index.php:/var/www/html/index.php - ./archive.php:/var/www/html/archive.php - ./config.php:/var/www/html/config.php depends_on: db: condition: service_healthy networks: default: aliases: - weather-web restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost/"] interval: 30s timeout: 10s retries: 3 db: image: mysql:8.0 environment: - MYSQL_ROOT_PASSWORD=root_pass - MYSQL_DATABASE=weather_db - MYSQL_USER=weather_user - MYSQL_PASSWORD=weather_pass volumes: - db_data:/var/lib/mysql - ./init.sql:/docker-entrypoint-initdb.d/init.sql networks: default: aliases: - db restart: unless-stopped healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uweather_user", "-pweather_pass"] timeout: 20s retries: 10 cron: image: ldhagen/ksat-weather-app:latest environment: - DB_HOST=db - DB_NAME=weather_db - DB_USER=weather_user - DB_PASS=weather_pass volumes: - ./cron-scripts/cron_fetch_weather.php:/app/cron_fetch_weather.php - ./config.php:/app/config.php command: > sh -c " echo '*/15 * * * * /usr/local/bin/php /app/cron_fetch_weather.php > /proc/1/fd/1 2>&1' > /etc/cron.d/weather-cron && chmod 0644 /etc/cron.d/weather-cron && crontab /etc/cron.d/weather-cron && exec cron -f" depends_on: db: condition: service_healthy restart: unless-stopped volumes: db_data: