Guest User

Untitled

a guest
Mar 2nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None | 0 0
  1. FROM ubuntu:xenial
  2.  
  3. # install dependencies
  4. RUN apt-get update
  5. RUN apt-get install -y software-properties-common python-software-properties
  6. RUN apt-get install -y language-pack-en-base
  7. RUN LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
  8.  
  9. # setup nginx and PHP
  10. RUN apt-get update &&
  11. apt-get install -y nginx
  12. php7.1
  13. php7.1-fpm
  14. php7.1-cli
  15. php7.1-common
  16. php7.1-json
  17. php7.1-opcache
  18. php7.1-mysql
  19. php7.1-mbstring
  20. php7.1-gd
  21. php7.1-imap
  22. php7.1-ldap
  23. php7.1-dev
  24. php7.1-intl
  25. php7.1-gd
  26. php7.1-curl
  27. php7.1-zip
  28. php7.1-xml
  29. php-redis
  30.  
  31. # change the configuration to disable clear_env
  32. RUN sed -e 's/;clear_env = no/clear_env = no/' -i /etc/php/7.1/fpm/pool.d/www.conf
  33.  
  34. # set up composer (we don't checksum the setup script)
  35. ENV COMPOSER_HOME /opt/composer
  36. RUN mkdir $COMPOSER_HOME &&
  37. cd $COMPOSER_HOME &&
  38. php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" &&
  39. php composer-setup.php &&
  40. php -r "unlink('composer-setup.php');" &&
  41. rm keys.dev.pub &&
  42. rm keys.tags.pub
  43. COPY composer.sh /usr/bin/composer
  44. RUN chmod 744 /usr/bin/composer
  45.  
  46. # download and install Symfony
  47. RUN mkdir -p /usr/local/bin &&
  48. curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony &&
  49. chmod a+x /usr/local/bin/symfony
  50.  
  51. ARG VERSION
  52. ENV VERSION $VERSION
  53.  
  54. ENV WORK_DIR /opt/api
  55.  
  56. # copy everything to /opt/api
  57. COPY . $WORK_DIR
  58. RUN chmod a+x /opt/api/entrypoint.sh
  59.  
  60. # move the configuration file to the right place
  61. RUN mv $WORK_DIR/nginx.conf /etc/nginx/sites-available/default
  62.  
  63. # fix the permissions for nginx and PHP
  64. RUN chown -R www-data:www-data $WORK_DIR/var &&
  65. chown -R www-data:www-data $WORK_DIR/app
  66.  
  67. # expose port 8000
  68. EXPOSE 8000
  69.  
  70. # make it a working directory
  71. WORKDIR $WORK_DIR
  72.  
  73. ENTRYPOINT ["/bin/sh", "/opt/api/entrypoint.sh"]
  74.  
  75. app_api:
  76. image: app/api:latest
  77. command: run
  78. links:
  79. - redis
  80. - mysql
  81. ports:
  82. - 8000:8000
  83. env_file:
  84. - ./app/config/parameters.env
  85. environment:
  86. DB_HOST: mysql
  87. DB_PORT: 3306
  88. DB_NAME: xxx
  89. DB_USER: xxx
  90. DB_PASSWORD: xxx
  91. REDIS_HOST: redis
  92. SECRET: xxx
  93. ENVIRONMENT: dev
  94. SUBENVIRONMENT: default
  95.  
  96. mysql:
  97. image: mysql:5.7
  98. expose:
  99. - 3306
  100. environment:
  101. MYSQL_ROOT_PASSWORD: xxx
  102. MYSQL_USER: xxx
  103. MYSQL_PASSWORD: xxx
  104. MYSQL_DATABASE: xxx
  105.  
  106. redis:
  107. image: redis:alpine
  108. expose:
  109. - 6379
  110.  
  111. #!/usr/bin/env bash
  112.  
  113. case $1 in
  114.  
  115. run)
  116. echo "---> RUN app/api"
  117. echo "clear_env = no" >> /etc/php/7.1/fpm/pool.d/www.conf
  118.  
  119. # start the PHP thing
  120. /etc/init.d/php7.1-fpm start &&
  121.  
  122. # clear cache
  123. composer dump-autoload &&
  124. php bin/console cache:clear --env=prod &&
  125. chown -R www-data:www-data var/cache/prod
  126.  
  127. # start the nginx in the foreground
  128. nginx -g "daemon off;"
  129.  
  130. shift 1
  131. ;;
  132.  
  133. {
  134. "name": "app/api",
  135. "license": "MIT",
  136. "type": "project",
  137. "autoload": {
  138. "psr-4": { "": "src/" },
  139. "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
  140. },
  141. "autoload-dev": {
  142. "psr-4": {
  143. "Tests\": "tests/"
  144. }
  145. },
  146. "require": {
  147. "php": ">=5.5.9",
  148. "symfony/symfony": "3.1.*",
  149. "doctrine/orm": "^2.5",
  150. "doctrine/doctrine-bundle": "^1.6",
  151. "doctrine/doctrine-cache-bundle": "^1.2",
  152. "symfony/swiftmailer-bundle": "^2.3",
  153. "symfony/monolog-bundle": "^2.8",
  154. "symfony/polyfill-apcu": "^1.0",
  155. "sensio/distribution-bundle": "^5.0",
  156. "sensio/framework-extra-bundle": "^3.0.2",
  157. "incenteev/composer-parameter-handler": "^2.0",
  158. "crell/api-problem": "^2.0",
  159. "prooph/service-bus-symfony-bundle": "^0.2.0",
  160. "prooph/event-store-symfony-bundle": "^0.2.2",
  161. "prooph/event-sourcing": "^4.0",
  162. "prooph/event-store-doctrine-adapter": "^3.2",
  163. "prooph/event-store-bus-bridge": "^2.0",
  164. "doctrine/doctrine-migrations-bundle": "^1.2",
  165. "nelmio/api-doc-bundle": "^2.13",
  166. "prooph/snapshot-doctrine-adapter": "^1.1",
  167. "mediamath/t1-php" : "^1.0.3",
  168. "guzzlehttp/guzzle": "^5.3.1|^6.2.1",
  169. "league/statsd": "^1.4",
  170. "prooph/snapshotter": "^1.1",
  171. "phpunit/phpunit": "^6.2.1"
  172. },
  173. "require-dev": {
  174. "sensio/generator-bundle": "^3.0",
  175. "symfony/phpunit-bridge": "^3.0"
  176. },
  177. "scripts": {
  178. "symfony-scripts": [
  179. "Incenteev\ParameterHandler\ScriptHandler::buildParameters",
  180. "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
  181. "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
  182. "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
  183. "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
  184. "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget"
  185. ],
  186. "post-install-cmd": [
  187. "@symfony-scripts"
  188. ],
  189. "post-update-cmd": [
  190. "@symfony-scripts"
  191. ]
  192. },
  193. "config": {
  194. "platform": {
  195. "php": "7.0.11"
  196. }
  197. },
  198. "extra": {
  199. "symfony-app-dir": "app",
  200. "symfony-bin-dir": "bin",
  201. "symfony-var-dir": "var",
  202. "symfony-web-dir": "web",
  203. "symfony-tests-dir": "tests",
  204. "symfony-assets-install": "relative",
  205. "incenteev-parameters": {
  206. "file": "app/config/parameters.yml"
  207. },
  208. "branch-alias": {
  209. "dev-master": "3.1-dev"
  210. }
  211. }
  212. }
Add Comment
Please, Sign In to add comment