尊龙凯时人生就是博

Symfony¿ò¼ÜµÄDocker×°ÖÃÒªÁìÓë°ì·¨

Symfony¿ò¼ÜµÄDocker×°ÖÃÒªÁìÓë°ì·¨

СÐò£º

DockerÊÇÒ»ÖÖÊ¢ÐеÄÈÝÆ÷»¯Æ½Ì¨ £¬¿ÉÒÔ×ÊÖúÎÒÃÇ¿ìËٴ¿ª·¢ÇéÐΡ£SymfonyÊÇÒ»ÖÖÓÅÒìµÄPHP¿ò¼Ü £¬¾ßÓÐÇ¿Ê¢µÄ¹¦Ð§ºÍÀ©Õ¹ÐÔ¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃDockerÀ´×°ÖúÍÉèÖÃSymfony¿ò¼Ü £¬²¢ÌṩÏêϸµÄ°ì·¨ºÍ´úÂëʾÀý¡£

°ì·¨Ò»£º×°ÖÃDockerºÍDocker Compose

Ê×ÏÈ £¬ÎÒÃÇÐèÒªÔÚÍâµØ×°ÖÃDockerºÍDocker Compose¡£Çëƾ֤×Ô¼ºµÄ²Ù×÷ϵͳÏÂÔز¢×°ÖÃÊʵ±µÄ°æ±¾¡£×°ÖÃÍê³Éºó £¬¿ÉÒÔÔÚÏÂÁîÐÐÖÐʹÓÔdocker”ºÍ”docker-compose”ÏÂÁî¾ÙÐÐÑéÖ¤¡£

°ì·¨¶þ£º½¨ÉèSymfonyÏîÄ¿

ÔÚ¾ÙÐÐÏÂÒ»²½Ö®Ç° £¬ÎÒÃÇÐèÒªÏȽ¨ÉèÒ»¸öSymfonyÏîÄ¿¡£·­¿ªÖÕ¶Ë £¬½øÈëÄãÏëÒªÉúÑÄÏîÄ¿µÄĿ¼ £¬È»ºóÔËÐÐÒÔÏÂÏÂÁ

$ composer create-project symfony/website-skeleton my_project_name

µÇ¼ºó¸´ÖÆ

Õ⽫ʹÓÃComposer½¨ÉèÒ»¸öеÄSymfonyÏîÄ¿ £¬²¢½«ÆäÉúÑÄÔÚÒ»¸öÃûΪ”my_project_name”µÄÎļþ¼ÐÖС£

°ì·¨Èý£º½¨ÉèDockerÉèÖÃÎļþ

ÔÚÏîÄ¿¸ùĿ¼Ï½¨ÉèÒ»¸öÃûΪ”docker-compose.yml”µÄÎļþ £¬ÓÃÓÚÉèÖÃDockerÈÝÆ÷¡£ÔÚ¸ÃÎļþÖÐ £¬ÎÒÃÇÐèÒªÖÁÉÙ½ç˵һ¸öPHPÈÝÆ÷ºÍÒ»¸öMySQLÈÝÆ÷¡£ÒÔÏÂÊÇÒ»¸öʾÀýÉèÖÃÎļþ£º

version: '3'
services:
  php:
    image: php:7.4-fpm
    volumes:
      - .:/var/www/html
    ports:
      - 8000:8000
    depends_on:
      - mysql
  mysql:
    image: mysql:latest
    restart: always
    volumes:
      - ./data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=your_mysql_root_password
      - MYSQL_DATABASE=your_database_name
      - MYSQL_USER=your_mysql_username
      - MYSQL_PASSWORD=your_mysql_password

µÇ¼ºó¸´ÖÆ

Çë×¢ÖØ £¬½«”your_mysql_root_password”¡¢”your_database_name”¡¢”your_mysql_username”ºÍ”your_mysql_password”Ì滻ΪÄã×Ô¼ºµÄÖµ¡£±ðµÄ £¬ÎÒÃÇ»¹½«ÏîÄ¿´úÂëÎļþ¼ÐÓ³Éäµ½ÁËPHPÈÝÆ÷µÄ”/var/www/html”·¾¶Ï £¬ÒÔ±ã¿ÉÒÔʵʱ±à¼­´úÂë¡£

°ì·¨ËÄ£º¹¹½¨ºÍÆô¶¯ÈÝÆ÷

ÔÚÖÕ¶ËÖнøÈëÏîÄ¿¸ùĿ¼ £¬È»ºóÔËÐÐÒÔÏÂÏÂÁîÀ´¹¹½¨ºÍÆô¶¯ÈÝÆ÷£º

$ docker-compose up -d

µÇ¼ºó¸´ÖÆ

´ËÏÂÁî»á×Ô¶¯ÏÂÔغ͹¹½¨ËùÐèµÄ¾µÏñ £¬²¢Æô¶¯ÈÝÆ÷¡£Äã¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¼ì²éÈÝÆ÷µÄ״̬£º

$ docker-compose ps

µÇ¼ºó¸´ÖÆ

ÈôÊÇÒ»ÇÐ˳Ëì £¬Ä㽫¿´µ½Á½¸öÈÝÆ÷£¨phpºÍmysql£©Õý³£ÔËÐС£

°ì·¨Î壺װÖÃSymfonyµÄÒÀÀµ°ü

ÔÚÈÝÆ÷ÖÐÔËÐÐÒÔÏÂÏÂÁîÀ´×°ÖÃSymfonyµÄÒÀÀµ°ü£º

$ docker-compose exec php composer install

µÇ¼ºó¸´ÖÆ

´ËÏÂÁʹÓÃComposer×°ÖÃSymfonyÏîÄ¿ËùÐèµÄËùÓÐÒÀÀµ°ü¡£

°ì·¨Áù£º»á¼ûSymfonyÓ¦ÓóÌÐò

ÔÚä¯ÀÀÆ÷ÖÐÊäÈë”http://localhost:8000″ £¬Ä㽫¿´µ½SymfonyµÄ½Ó´ýÒ³Ãæ¡£Õâ˵Ã÷SymfonyÓ¦ÓóÌÐòÒѾ­ÀÖ³É×°Öò¢ÕýÔÚÔËÐС£

½áÂÛ£º

±¾ÎÄÏÈÈÝÁËʹÓÃDocker×°ÖúÍÉèÖÃSymfony¿ò¼ÜµÄÏêϸ°ì·¨ºÍ´úÂëʾÀý¡£Ê¹ÓÃDocker¿ÉÒÔ¸üÇáËɵشºÍÖÎÀíSymfony¿ª·¢ÇéÐÎ £¬Ìá¸ß¿ª·¢Ð§ÂʺÍÏîÄ¿¿ÉÒÆÖ²ÐÔ¡£Ï£ÍûÕâƪÎÄÕÂÄܹ»×ÊÖúÄãÀÖ³É×°ÖúÍʹÓÃSymfony¿ò¼Ü¡£×£Äã±àд³öÓÅÒìµÄSymfonyÓ¦ÓóÌÐò£¡

ÒÔÉϾÍÊÇSymfony¿ò¼ÜµÄDocker×°ÖÃÒªÁìÓë°ì·¨µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ