Guest User

Untitled

a guest
Apr 9th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.85 KB | None | 0 0
  1. -test
  2. - .docker
  3. - Dockerfile
  4. - vhost.conf
  5. - docker-compose.yml
  6. - ...other files
  7.  
  8. # use version 3 of the docker compose syntax
  9. version: '3'
  10. services:
  11. # we named our first service 'web'
  12. web:
  13. # pass a hostname to the container (optinal)
  14. hostname: test
  15.  
  16. # build a custom image
  17. build: ./.docker
  18.  
  19. working_dir: /var/www
  20.  
  21. # a name for easier reference
  22. image: test:1.0
  23.  
  24. # map host port 8080 to container port 80
  25. ports:
  26. - 8080:80
  27.  
  28. # volumes are like shared folders
  29. # container will see your local code changes
  30. volumes:
  31. - .:/app
  32.  
  33. # first load the 'db' service
  34. depends_on:
  35. - db
  36.  
  37. # make 'db' a known service/host inside of 'web'
  38. # use this to make a mysql connection to host 'db'
  39. links:
  40. - db
  41.  
  42. db:
  43. # use a default image
  44. image: mysql:5.7
  45.  
  46. # again, port mapping
  47. # e.g. to use Sequel Pro on our mac
  48. ports:
  49. - 13306:3306
  50.  
  51. # the mysql image uses these to create database and users
  52. environment:
  53. MYSQL_ROOT_PASSWORD: test
  54. MYSQL_DATABASE: test
  55. MYSQL_USER: test
  56. MYSQL_PASSWORD: test
  57.  
  58. #
  59. # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
  60. #
  61. # PLEASE DO NOT EDIT IT DIRECTLY.
  62. #
  63.  
  64. FROM alpine:3.4
  65.  
  66. # dependencies required for running "phpize"
  67. # these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed)
  68. ENV PHPIZE_DEPS
  69. autoconf
  70. dpkg-dev dpkg
  71. file
  72. g++
  73. gcc
  74. libc-dev
  75. make
  76. pkgconf
  77. re2c
  78.  
  79. # persistent / runtime deps
  80. RUN apk add --no-cache --virtual .persistent-deps
  81. ca-certificates
  82. curl
  83. tar
  84. xz
  85. # https://github.com/docker-library/php/issues/494
  86. openssl
  87.  
  88. # ensure www-data user exists
  89. RUN set -x
  90. && addgroup -g 82 -S www-data
  91. && adduser -u 82 -D -S -G www-data www-data
  92. # 82 is the standard uid/gid for "www-data" in Alpine
  93. # http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2
  94. # http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2
  95. # http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2
  96.  
  97. ENV PHP_INI_DIR /usr/local/etc/php
  98. RUN mkdir -p $PHP_INI_DIR/conf.d
  99.  
  100. ##<autogenerated>##
  101. ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
  102. ##</autogenerated>##
  103.  
  104. # Apply stack smash protection to functions using local buffers and alloca()
  105. # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64)
  106. # Enable optimization (-O2)
  107. # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default)
  108. # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated)
  109. # https://github.com/docker-library/php/issues/272
  110. ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2"
  111. ENV PHP_CPPFLAGS="$PHP_CFLAGS"
  112. ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
  113.  
  114. ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3
  115.  
  116. ENV PHP_VERSION 5.6.35
  117. ENV PHP_URL="https://secure.php.net/get/php-5.6.35.tar.xz/from/this/mirror" PHP_ASC_URL="https://secure.php.net/get/php-5.6.35.tar.xz.asc/from/this/mirror"
  118. ENV PHP_SHA256="9985cb64cb8224c289effff5b34f670d14f838175f76daea0507d643eec650d2" PHP_MD5=""
  119.  
  120. RUN set -xe;
  121.  
  122. apk add --no-cache --virtual .fetch-deps
  123. gnupg
  124. ;
  125.  
  126. mkdir -p /usr/src;
  127. cd /usr/src;
  128.  
  129. wget -O php.tar.xz "$PHP_URL";
  130.  
  131. if [ -n "$PHP_SHA256" ]; then
  132. echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -;
  133. fi;
  134. if [ -n "$PHP_MD5" ]; then
  135. echo "$PHP_MD5 *php.tar.xz" | md5sum -c -;
  136. fi;
  137.  
  138. if [ -n "$PHP_ASC_URL" ]; then
  139. wget -O php.tar.xz.asc "$PHP_ASC_URL";
  140. export GNUPGHOME="$(mktemp -d)";
  141. for key in $GPG_KEYS; do
  142. gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key";
  143. done;
  144. gpg --batch --verify php.tar.xz.asc php.tar.xz;
  145. rm -rf "$GNUPGHOME";
  146. fi;
  147.  
  148. apk del .fetch-deps
  149.  
  150. COPY docker-php-source /usr/local/bin/
  151.  
  152. RUN set -xe
  153. && apk add --no-cache --virtual .build-deps
  154. $PHPIZE_DEPS
  155. coreutils
  156. curl-dev
  157. libedit-dev
  158. openssl-dev
  159. libxml2-dev
  160. sqlite-dev
  161.  
  162. && export CFLAGS="$PHP_CFLAGS"
  163. CPPFLAGS="$PHP_CPPFLAGS"
  164. LDFLAGS="$PHP_LDFLAGS"
  165. && docker-php-source extract
  166. && cd /usr/src/php
  167. && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"
  168. && ./configure
  169. --build="$gnuArch"
  170. --with-config-file-path="$PHP_INI_DIR"
  171. --with-config-file-scan-dir="$PHP_INI_DIR/conf.d"
  172.  
  173. --disable-cgi
  174.  
  175. # --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
  176. --enable-ftp
  177. # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
  178. --enable-mbstring
  179. # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
  180. --enable-mysqlnd
  181.  
  182. --with-curl
  183. --with-libedit
  184. --with-openssl
  185. --with-zlib
  186.  
  187. # bundled pcre does not support JIT on s390x
  188. # https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
  189. $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit')
  190.  
  191. $PHP_EXTRA_CONFIGURE_ARGS
  192. && make -j "$(nproc)"
  193. && make install
  194. && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; }
  195. && make clean
  196. && cd /
  197. && docker-php-source delete
  198.  
  199. && runDeps="$(
  200. scanelf --needed --nobanner --format '%n#p' --recursive /usr/local
  201. | tr ',' 'n'
  202. | sort -u
  203. | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }'
  204. )"
  205. && apk add --no-cache --virtual .php-rundeps $runDeps
  206.  
  207. && apk del .build-deps
  208.  
  209. # https://github.com/docker-library/php/issues/443
  210. && pecl update-channels
  211. && rm -rf /tmp/pear ~/.pearrc
  212.  
  213. COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
  214.  
  215. ENTRYPOINT ["docker-php-entrypoint"]
  216. ##<autogenerated>##
  217. WORKDIR /var/www/html
  218.  
  219. RUN set -ex
  220. && cd /usr/local/etc
  221. && if [ -d php-fpm.d ]; then
  222. # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
  223. sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null;
  224. cp php-fpm.d/www.conf.default php-fpm.d/www.conf;
  225. else
  226. # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
  227. mkdir php-fpm.d;
  228. cp php-fpm.conf.default php-fpm.d/www.conf;
  229. {
  230. echo '[global]';
  231. echo 'include=etc/php-fpm.d/*.conf';
  232. } | tee php-fpm.conf;
  233. fi
  234. && {
  235. echo '[global]';
  236. echo 'error_log = /proc/self/fd/2';
  237. echo;
  238. echo '[www]';
  239. echo '; if we send this to /proc/self/fd/1, it never appears';
  240. echo 'access.log = /proc/self/fd/2';
  241. echo;
  242. echo 'clear_env = no';
  243. echo;
  244. echo '; Ensure worker stdout and stderr are sent to the main error log.';
  245. echo 'catch_workers_output = yes';
  246. } | tee php-fpm.d/docker.conf
  247. && {
  248. echo '[global]';
  249. echo 'daemonize = no';
  250. echo;
  251. echo '[www]';
  252. echo 'listen = 9000';
  253. } | tee php-fpm.d/zz-docker.conf
  254.  
  255. EXPOSE 9000
  256. CMD ["php-fpm"]
  257. ##</autogenerated>##
Add Comment
Please, Sign In to add comment