Logo docker : une baleine bleu portant des containers

Docker

Bon on va faire rapide, y'a déjà des dizaines de topics sur le sujet. En bref, docker, c'est une petite VM ! Tu définis ce que ton image va être ( distrib, package, outils...) et tu peux repliquer cette image. Plus besoin d'installer votre db localement, une image docker existe déjà ! Dans mon cas, j'voulais une db et un server Php

Dockerfile

FROM dunglas/frankenphp:1-php8.4 AS server_base WORKDIR /app VOLUME /app/var/ # persistent / runtime deps # hadolint ignore=DL3008 RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ file \ git \ ; \ \ mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"; \ \ install-php-extensions \ @composer \ apcu \ intl \ opcache \ zip \ pdo_mysql \ mysqli \ gd \ ; # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser ENV COMPOSER_ALLOW_SUPERUSER=1 ENV APP_ENV=dev ENV XDEBUG_MODE=off ENV FRANKENPHP_WORKER_CONFIG=watch RUN set -eux; \ install-php-extensions \ xdebug \ ; \ \ { \ echo 'opcache.validate_timestamps=1'; \ echo 'opcache.revalidate_freq=0'; \ echo 'memory_limit=512M'; \ } > "$PHP_INI_DIR/conf.d/dev.ini"; CMD [ "frankenphp", "run", "--config", "/etc/frankenphp/Caddyfile", "--watch" ]

Compose.yml

version: '3.7' services: database: image: 'mysql:latest' environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: blogSymfony ports: - "3307:3306" expose: - "3306" php: depends_on: - database build: target: server_base context: . volumes: - ./:/app environment: DATABASE_URL: mysql://root:password@database:3306/blogSymfony?serverVersion=latest&charset=utf8mb4 SERVER_NAME: localhost:443 FRANKENPHP_WORKER_CONFIG: watch # See https://xdebug.org/docs/all_settings#mode XDEBUG_MODE: "${XDEBUG_MODE:-off}" APP_ENV: dev ports: - name: http target: 81 published: ${HTTP_PORT:-81} protocol: tcp - name: https target: 443 published: ${HTTPS_PORT:-443} protocol: tcp - name: http3 target: 443 published: ${HTTP3_PORT:-443} protocol: udp extra_hosts: # Ensure that host.docker.internal is correctly defined on Linux - host.docker.internal:host-gateway tty: true ###> symfony/mercure-bundle ### volumes: caddy_data: caddy_config: