docker_lnmp封装mosquitto
题目描述
如何在原有的dockerfile上添加对应的镜像封装到docker
题目来源及自己的思路
我是使用了开源的dockerdnmp
https://github.com/yeszao/dnmp
然后我参考了
https://github.com/klein0r/ph...
进行整合,代码如下
我把代码放入Dockerfile后的
RUN apt-get update
# Install dependencies
RUN apt-get update && apt-get upgrade -y --force-yes && apt-get install -y --force-yes --no-install-recommends apt-utils
RUN apt-get -y --force-yes install git vim
RUN mkdir -p /opt/analytics-mqtt && git clone https://github.com/klein0r/php-analytics-mqtt.git /opt/analytics-mqtt
RUN cd /opt/analytics-mqtt && php composer.phar install
WORKDIR /opt/analytics-mqtt
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
这是我docker-compose.yml
version: "3"
services:
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./www/:/var/www/html/:rw
- ./conf/conf.d:/etc/nginx/conf.d/:ro
- ./conf/nginx.conf:/etc/nginx/nginx.conf:ro
- ./log/:/var/log/dnmp/:rw
restart: always
networks:
- net-php72
- net-php56
- net-php54
php72:
build:
context: .
args:
PHP_VERSION: 7.2
SOURCE_LIST: stretch
XDEBUG_VERSION: 2.6.1
SWOOLE_VERSION: 4.2.1
SUPPORT_MCRYPT: "false"
BUILT_IN_OPCACHE: "true"
expose:
- "9000"
volumes:
- ./www/:/var/www/html/:rw
- ./conf/php.ini:/usr/local/etc/php/php.ini:ro
- ./conf/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf:rw
- ./log/:/var/log/dnmp/:rw
restart: always
cap_add:
- SYS_PTRACE
networks:
- net-php72
- net-mysql
- net-redis
php56:
build:
context: .
args:
PHP_VERSION: 5.6
SOURCE_LIST: jessie
XDEBUG_VERSION: 2.5.5
SWOOLE_VERSION: 2.0.11
SUPPORT_MCRYPT: "true"
BUILT_IN_OPCACHE: "true"
expose:
- "9000"
volumes:
- ./www/:/var/www/html/:rw
- ./conf/php.ini:/usr/local/etc/php/php.ini:ro
- ./conf/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf:rw
- ./log/:/var/log/dnmp/:rw
restart: always
cap_add:
- SYS_PTRACE
networks:
- net-php56
- net-mysql
- net-redis
php54:
build:
context: .
args:
PHP_VERSION: 5.4
SOURCE_LIST: jessie
XDEBUG_VERSION: 2.4.1
SWOOLE_VERSION: "false"
SUPPORT_MCRYPT: "true"
BUILT_IN_OPCACHE: "false"
expose:
- "9000"
volumes:
- ./www/:/var/www/html/:rw
- ./conf/php.ini:/usr/local/etc/php/php.ini:ro
- ./conf/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf:rw
- ./log/:/var/log/dnmp/:rw
restart: always
cap_add:
- SYS_PTRACE
networks:
- net-php54
- net-mysql
- net-redis
mysql:
image: mysql:8.0
ports:
- "3307:3306"
volumes:
- ./conf/mysql.cnf:/etc/mysql/conf.d/mysql.cnf:ro
- ./mysql/:/var/lib/mysql/:rw
restart: always
networks:
- net-mysql
environment:
MYSQL_ROOT_PASSWORD: "123456"
redis:
image: redis:4.0
restart: always
networks:
- net-redis
ports:
- "6380:6379"
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- "8080:80"
networks:
- net-mysql
environment:
- PMA_HOST=mysql
- PMA_PORT=3306
phpredisadmin:
image: erikdubbelboer/phpredisadmin:latest
ports:
- "8081:80"
networks:
- net-redis
environment:
- REDIS_1_HOST=redis
- REDIS_1_PORT=6379
networks:
net-php72:
net-php56:
net-php54:
net-mysql:
net-redis:
这是我的Dockerfile
ARG PHP_VERSION
FROM php:${PHP_VERSION}-fpm
ARG SOURCE_LIST
ARG XDEBUG_VERSION
ARG SWOOLE_VERSION
ARG REDIS_VERSION=4.1.1
ARG SUPPORT_MCRYPT
ARG BUILT_IN_OPCACHE
COPY ./sources.list/$SOURCE_LIST /etc/apt/sources.list
RUN apt-get update
# Composer
RUN php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php');" \
&& mv composer.phar /bin/composer \
&& composer config -g repo.packagist composer https://packagist.phpcomposer.com
# Install extensions from source
COPY ./extensions /tmp/extensions
RUN chmod +x /tmp/extensions/install.sh \
&& /tmp/extensions/install.sh \
&& rm -rf /tmp/extensions
# More extensions
# 1. soap requires libxml2-dev.
# 2. xml, xmlrpc, wddx require libxml2-dev and libxslt-dev.
# 3. Line `&& :\` do nothing just for better reading.
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd \
&& :\
&& apt-get install -y libicu-dev \
&& docker-php-ext-install intl \
&& :\
&& apt-get install -y libxml2-dev \
&& apt-get install -y libxslt-dev \
&& docker-php-ext-install soap \
&& docker-php-ext-install xsl \
&& docker-php-ext-install xmlrpc \
&& docker-php-ext-install wddx \
&& :\
&& apt-get install -y libbz2-dev \
&& docker-php-ext-install bz2 \
&& :\
&& docker-php-ext-install zip \
&& docker-php-ext-install pcntl \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install mysqli \
&& docker-php-ext-install mbstring \
&& docker-php-ext-install exif \
&& docker-php-ext-install bcmath \
&& docker-php-ext-install calendar \
&& docker-php-ext-install sockets \
&& docker-php-ext-install gettext \
&& docker-php-ext-install shmop \
&& docker-php-ext-install sysvmsg \
&& docker-php-ext-install sysvsem \
&& docker-php-ext-install sysvshm \
&& docker-php-ext-install mysql \
#&& docker-php-ext-install ZendGuardLoader \
#&& docker-php-ext-install opcache \
#&& docker-php-ext-install pdo_firebird \
#&& docker-php-ext-install pdo_dblib \
#&& docker-php-ext-install pdo_oci \
#&& docker-php-ext-install pdo_odbc \
#&& docker-php-ext-install pdo_pgsql \
#&& docker-php-ext-install pgsql \
#&& docker-php-ext-install oci8 \
#&& docker-php-ext-install odbc \
#&& docker-php-ext-install dba \
#&& docker-php-ext-install interbase \
#&& :\
#&& apt-get install -y curl \
#&& apt-get install -y libcurl3 \
#&& apt-get install -y libcurl4-openssl-dev \
#&& docker-php-ext-install curl \
#&& :\
#&& apt-get install -y libreadline-dev \
#&& docker-php-ext-install readline \
#&& :\
#&& apt-get install -y libsnmp-dev \
#&& apt-get install -y snmp \
#&& docker-php-ext-install snmp \
#&& :\
#&& apt-get install -y libpspell-dev \
#&& apt-get install -y aspell-en \
#&& docker-php-ext-install pspell \
#&& :\
#&& apt-get install -y librecode0 \
#&& apt-get install -y librecode-dev \
#&& docker-php-ext-install recode \
#&& :\
#&& apt-get install -y libtidy-dev \
#&& docker-php-ext-install tidy \
#&& :\
#&& apt-get install -y libgmp-dev \
#&& ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h \
#&& docker-php-ext-install gmp \
#&& :\
#&& apt-get install -y postgresql-client \
#&& apt-get install -y mysql-client \
#&& :\
#&& apt-get install -y libc-client-dev \
#&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
#&& docker-php-ext-install imap \
#&& :\
#&& apt-get install -y libldb-dev \
#&& apt-get install -y libldap2-dev \
#&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu \
#&& docker-php-ext-install ldap \
#&& :\
#&& apt-get install -y libmagickwand-dev \
#&& pecl install imagick-3.4.3 \
#&& docker-php-ext-enable imagick \
&& :\
&& apt-get install -y libmemcached-dev zlib1g-dev \
&& pecl install memcached-2.2.0 \
&& pecl install Mosquitto-alpha \
&& docker-php-ext-enable memcached
你期待的结果是什么?实际看到的错误信息又是什么?
希望能兼容封装进去,但是我尝试了修修改改,报错依然很多
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论