Laravel 5 docker

Vckin發表於2018-12-07

docker-compose.yml

version: "2"
services:
  vckin_mariadb:
    build: mariadb/.
    ports:
      - 3306:3306
    container_name: vckin_mariadb
    restart: always
    privileged: true
  vckin_tnginx-php7:
    build: tnginx-php7/.
    ports:
      - 443:443
      - 80:80
    depends_on:
      - vckin_mariadb
    links:
      - vckin_mariadb
    volumes:
      - /Users/vckin/Desktop/woker_code/l_test:/var/www
    container_name: vckin_tnginx-php7
    restart: always
    privileged: true

mariadb Dockerfile

# ################################## #
# tnginx2.2.2 php7.0.31 mariadb10.1  #
# author vckin                       #
# date 2018 08 17                    #
# ################################## #

FROM docker.io/centos:latest
MAINTAINER vckin
# MariaDB 10.1
COPY MariaDB.repo /etc/yum.repos.d/
RUN yum clean all
RUN rpm --import /etc/pki/rpm-gpg/RPM*
RUN yum install MariaDB-server MariaDB-client -y --nogpgcheck
EXPOSE 3306
ADD my.cnf /etc/
#Start
ADD start.sh /
RUN chmod +x /start.sh
#Start web server
RUN /start.sh
ENTRYPOINT ["/usr/sbin/init"] -D

tnginx-php7 Dockerfile

# ################################## #
# tnginx2.2.2 php7.0.31 mariadb10.1  #
# author vckin                       #
# date 2018 08 17                    #
# ################################## #

FROM docker.io/centos:latest

MAINTAINER vckin

# install need cmd

RUN yum clean all
RUN rpm --import /etc/pki/rpm-gpg/RPM*
RUN yum -y install wget --nogpgcheck
RUN yum -y install gcc-c++  pcre pcre-devel  zlib zlib-devel openssl openssl-devel --setopt=protected_multilib=false --nogpgcheck

# install php 7.0.31

ADD ./epel-release-latest-7.noarch.rpm /home/
ADD ./webtatic-release.rpm /home/

WORKDIR /home
#RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm --force --nodeps 
RUN rpm -Uvh epel-release-latest-7.noarch.rpm 
#RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm --force --nodeps
RUN rpm -Uvh webtatic-release.rpm
RUN yum clean all
#RUN rpm --import /etc/pki/rpm-gpg/RPM*
RUN yum install php70w php70w-cli php70w-common php70w-devel php70w-embedded php70w-fpm php70w-gd php70w-mbstring php70w-mysql php70w-opcache php70w-pdo php70w-xml -y --nogpgcheck
ADD php.ini /etc/

# Tnginx 2.2.2

COPY tengine-2.2.2.tar.gz /home/
#RUN wget http://tengine.taobao.org/download/tengine-2.2.2.tar.gz
RUN pwd
WORKDIR /home
RUN tar -zxvf tengine-2.2.2.tar.gz
WORKDIR /home/tengine-2.2.2
RUN ./configure --prefix=/usr/local/nginx
RUN make && make install
COPY nginx.service /lib/systemd/system
RUN chmod 745 /lib/systemd/system/nginx.service

ADD nginx.conf /usr/local/nginx/conf
RUN mkdir -p /var/www
VOLUME ["/var/www"]
ADD index.php /var/www/

EXPOSE 443 80
#Start
ADD start.sh /
RUN chmod +x /start.sh
#Start web server
RUN /start.sh
ENTRYPOINT ["/usr/sbin/init"] -D
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章