码迷,mamicode.com
首页 > 其他好文 > 详细

docker-compose部署lnmp环境

时间:2020-01-04 18:49:32      阅读:445      评论:0      收藏:0      [点我收藏+]

标签:部署   contain   memcache   linu   mes   log   repo   nss   share   

docker-compose.yml配置文件如下

version: "2"
services:
  nginx:
    image: nginx:alpine
    container_name: my-nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./conf/nginx/conf.d/:/etc/nginx/conf.d/:ro
      - ./conf/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./log/nginx/:/var/log/nginx/:rw
      - ./www/:/var/www/:rw
    networks:
      - net-php

  php:
    build: ./php/php56/
    expose:
      - "9000"
    volumes:
      - ./conf/php/php.ini:/etc/php/php.ini:ro
      - ./conf/php/php-fpm.conf:/etc/php/php-fpm.conf:ro
      - ./log/php/:/var/log/php/:rw
      - ./www/:/var/www/:rw
    networks:
      - net-php


networks:
  net-php:

 php5.6 Dockerfile如下

FROM alpine:3.3

RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.3/main" > /etc/apk/repositories

ENV TIMEZONE Asia/Shanghai

RUN apk update &&   apk add --no-cache tzdata &&   cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime &&   echo "${TIMEZONE}" > /etc/timezone &&   apk add php-intl     php-mcrypt     php-openssl     php-gmp     php-json     php-dom     php-pdo     php-zip     php-zlib     php-mysqli     php-bcmath     php-gd     php-xcache     php-pdo_mysql     php-gettext     php-xmlreader     php-xmlrpc     php-bz2     php-memcache     php-iconv     php-curl     php-ctype     php-fpm     php-phar     php &&   apk del tzdata &&   rm -rf /var/cache/apk/*
RUN set -x   && addgroup -g 82 -S www-data   && adduser -u 82 -D -s /sbin/nologin -h /var/www -G www-data www-data
RUN mkdir /var/log/php   && chown -R www-data:www-data /var/log/php   && chmod -R 774 /var/log/php

EXPOSE 9000
CMD ["php-fpm", "-F"]

  

docker-compose部署lnmp环境

标签:部署   contain   memcache   linu   mes   log   repo   nss   share   

原文地址:https://www.cnblogs.com/caidingyu/p/12149682.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!