×ðÁú¿­Ê±

ʹÓÃDocker¾ÙÐÐSymfony¿ò¼ÜµÄ¿ìËÙ×°ÖÃ

ÎÊÌ⣺ʹÓÃDocker¾ÙÐÐSymfony¿ò¼ÜµÄ¿ìËÙ×°ÖÃ

ͻ񻣼

±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃDockerÈÝÆ÷ÊÖÒÕ¿ìËÙ×°ÖÃSymfony¿ò¼Ü¡£Í¨¹ýDocker£¬Äú¿ÉÒÔÇáËɽ¨ÉèºÍÖÎÀíSymfony¿ª·¢ÇéÐΣ¬²¢ïÔÌ­ÓÉÓÚ²î±ðÉèÖöø±¬·¢µÄÎÊÌâ¡£±¾ÎĽ«ÏêϸÏÈÈÝÔõÑù×¼±¸DockerÇéÐÎÒÔ¼°ÔõÑùʹÓÃDocker ComposeÀ´¿ìËÙ°²ÅÅSymfonyÓ¦ÓóÌÐò¡£

ÕýÎÄ£º

Ò»¡¢×¼±¸ÊÂÇé

ÔÚ×îÏÈ֮ǰ£¬È·±£ÄúÒѾ­×°ÖÃÁËÒÔÏÂÈí¼þ£º

Docker£ºÄú¿ÉÒÔ´Ó¹Ù·½ÍøÕ¾£¨https://www.docker.com/products/docker-desktop£©ÏÂÔز¢×°ÖÃDocker¡£

Composer£ºComposerÊÇPHPµÄÒÀÀµÖÎÀí¹¤¾ß¡£Äú¿ÉÒÔ´Ó¹Ù·½ÍøÕ¾£¨https://getcomposer.org/download/£©ÏÂÔز¢×°ÖÃComposer¡£

¶þ¡¢½¨ÉèSymfonyÓ¦ÓóÌÐò

·­¿ªÖն˻òÏÂÁîÌáÐÑ·û£¬½øÈëÄúÒª½¨ÉèSymfonyÓ¦ÓóÌÐòµÄĿ¼¡£

ÔËÐÐÒÔÏÂÏÂÁîÀ´½¨ÉèSymfonyÓ¦ÓóÌÐò£º

docker run --rm -v $(pwd):/app composer create-project symfony/skeleton myapp

µÇ¼ºó¸´ÖÆ

Õ⽫ʹÓÃComposerÀ´½¨ÉèÒ»¸öÃûΪ”myapp”µÄSymfonyÓ¦ÓóÌÐò¡£

Èý¡¢½¨ÉèDockerÇéÐÎ

ÔÚSymfonyÓ¦ÓóÌÐòµÄ¸ùĿ¼Öн¨ÉèÒ»¸öÃûΪDockerfileµÄÎļþ£¬²¢½«ÒÔÏÂÄÚÈÝÕ³Ìùµ½ÎļþÖУº

FROM php:7.4-apache
WORKDIR /var/www/html

RUN apt-get update && apt-get install -y 
 libicu-dev 
 libpq-dev 
 git 
 unzip 
 && docker-php-ext-install 
 intl 
 pdo_pgsql 
 && a2enmod 
 rewrite

COPY --from=composer /usr/bin/composer /usr/local/bin/composer
COPY . /var/www/html/
RUN composer install --prefer-dist --no-progress --no-suggest --no-interaction

EXPOSE 80

µÇ¼ºó¸´ÖÆ

½¨ÉèÒ»¸öÃûΪdocker-compose.ymlµÄÎļþ£¬²¢½«ÒÔÏÂÄÚÈݸ´ÖƵ½ÎļþÖУº

version: '3'
services:
  app:
 build:
   context: .
   dockerfile: Dockerfile
 ports:
   - 8000:80
 volumes:
   - .:/var/www/html

µÇ¼ºó¸´ÖÆ

Õâ¸ödocker-compose.ymlÎļþ½ç˵ÁËÒ»¸öÃûΪ”app”µÄЧÀÍ£¬²¢½«¶Ë¿Ú8000Ó³Éäµ½ÈÝÆ÷µÄ80¶Ë¿Ú¡£

ËÄ¡¢ÔËÐÐSymfonyÓ¦ÓóÌÐò

ÔÚÖն˻òÏÂÁîÌáÐÑ·ûÖУ¬½øÈëSymfonyÓ¦ÓóÌÐòµÄ¸ùĿ¼¡£

ÔËÐÐÒÔÏÂÏÂÁîÀ´¹¹½¨ºÍÆô¶¯DockerÈÝÆ÷£º

docker-compose up -d

µÇ¼ºó¸´ÖÆ

ÆÚ´ýÒ»¶Îʱ¼ä£¬Ö±µ½ÈÝÆ÷Æô¶¯Íê³É¡£È»ºó£¬Äú¿ÉÒÔͨ¹ýÔÚä¯ÀÀÆ÷Öлá¼û”http://localhost:8000″À´Éó²éSymfonyÓ¦ÓóÌÐò¡£

¿¢ÊÂÓ

ͨ¹ýʹÓÃDocker¾ÙÐÐSymfony¿ò¼ÜµÄ¿ìËÙ×°Öã¬Äú¿ÉÒÔÇáËɽ¨ÉèºÍÖÎÀíSymfony¿ª·¢ÇéÐΡ£±¾ÎÄÌṩÁËÏêϸµÄ°ì·¨ºÍ´úÂëʾÀý£¬×ÊÖúÄú¿ìËÙÈëÃŲ¢×îÏÈʹÓÃSymfony¾ÙÐÐWeb¿ª·¢¡£×£Äú˳ËìÍê³ÉSymfonyÓ¦ÓóÌÐòµÄ×°ÖúͿª·¢£¡

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

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

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

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