RahinRahi

Docker file example

Dec 18th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.77 KB | None | 0 0
  1. //docker file
  2. FROM ubuntu:16.04
  3. MAINTAINER Rahi  <rahnrahi@gmail.com>
  4.  
  5. RUN apt-get update && \
  6.    apt-get install -y software-properties-common && \
  7.    apt-get update && \
  8.    apt-get install -y \
  9.      apache2 \
  10.      php7.0 \
  11.      php7.0-cli \
  12.      libapache2-mod-php7.0 \
  13.      php7.0-gd \
  14.      php7.0-json \
  15.      php7.0-ldap \
  16.      php7.0-mbstring \
  17.      php7.0-mysql \
  18.      php7.0-pgsql \
  19.      php7.0-sqlite3 \
  20.      php7.0-xml \
  21.      php7.0-xsl \
  22.      php7.0-zip \
  23.      php7.0-soap \
  24.      php7.0-curl \
  25.      mysql-client \
  26.      curl \
  27.      vim \
  28.      openssl \
  29.      git \
  30.      composer \
  31.      zip \
  32.      unzip
  33.  
  34. # Set environment variables for Apache so we know its user and group names
  35. ENV APACHE_RUN_USER www-data
  36. ENV APACHE_RUN_GROUP www-data
  37.  
  38. # Configure Apache SSL and Standard Virtualhosts
  39. COPY config/apache_default.conf /etc/apache2/sites-available/000-default.conf
  40. COPY config/apache_default-ssl.conf /etc/apache2/sites-available/default-ssl.conf
  41.  
  42. # Configure SSL Directories & Create Temporary SSL Keys
  43. RUN mkdir /etc/apache2/ssl
  44. RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt  -subj "/C=US/ST=Florida/L=Fort Lauderdale/O=Pool Service Software LLC/OU=IT Department/CN=dev.poolservice.software.local"
  45.  
  46. RUN a2enmod rewrite
  47.  
  48. #Configure SSL On Apache2
  49. RUN a2enmod ssl
  50. RUN service apache2 restart
  51. RUN a2ensite default-ssl.conf
  52. RUN service apache2 restart
  53.  
  54. # Download and install wkhtmltopdf
  55. RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential xorg libssl-dev libxrender-dev wget gdebi libxrender1 xfonts-utils xfonts-base xfonts-75dpi libfontenc1 x11-common xfonts-encodings libxfont1 fontconfig
  56. RUN wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
  57. RUN gdebi --n wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
  58. RUN echo 'exec xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf "$@"' | tee /usr/local/bin/wkhtmltopdf.sh >/dev/null && sudo chmod a+x /usr/local/bin/wkhtmltopdf.sh
  59.  
  60. COPY config/run /usr/local/bin/run
  61. RUN chmod +x /usr/local/bin/run
  62.  
  63. # Install oAuth
  64.  
  65. RUN apt-get update \
  66.     && apt-get install -y \
  67.     libpcre3 \
  68.     libpcre3-dev \
  69.     php-pear \
  70.        php-dev \
  71.        && pecl install oauth \
  72.        && echo 'extension=oauth.so' >> /etc/php/7.0/cli/conf.d/oauth.ini
  73.  
  74.  
  75. EXPOSE 80
  76. EXPOSE 443
  77.  
  78. CMD ["/usr/local/bin/run"]
  79.  
  80.  
  81. ###############################################################
  82.  
  83. docker-compose.yml
  84. version: '2'
  85. services:  
  86.    dblive:
  87.        image: mysql:5.5.52
  88.        volumes:
  89.            - ./db_data_live:/var/lib/mysql
  90.        restart: always
  91.        environment:
  92.            MYSQL_ROOT_PASSWORD: ^^Florida123
  93.            MYSQL_DATABASE: chippers
  94.            MYSQL_USER: adminlive
  95.            MYSQL_PASSWORD: ^^Florida123
  96.    
  97.    dbdev:
  98.        image: mysql:5.5.52
  99.        volumes:
  100.            - ./db_data_dev:/var/lib/mysql
  101.        restart: always
  102.        environment:
  103.            MYSQL_ROOT_PASSWORD: ^^Florida123
  104.            MYSQL_DATABASE: chippers
  105.            MYSQL_USER: admindev
  106.            MYSQL_PASSWORD: ^^Florida123
  107.    
  108.    phpmyadmin:
  109.        depends_on:
  110.            - dblive
  111.            - dbdev
  112.        image: phpmyadmin/phpmyadmin
  113.        environment:
  114.            PMA_ARBITRARY : 1
  115.        restart: always
  116.        ports:
  117.            - "8081:80"
  118.            
  119.    web:
  120.        #build: ./
  121.        depends_on:
  122.            - dblive
  123.            - dbdev
  124.        image: rahi/local:latest
  125.        volumes:
  126.            - ./web:/var/www
  127.            - ./config/custom.php.ini:/etc/php/7.0/apache2/php.ini
  128.            - ./config/apache_default.conf:/etc/apache2/sites-available/000-default.conf
  129.            - ./config/apache_default-ssl.conf:/etc/apache2/sites-available/default-ssl.conf
  130.            - ./logs/apache_error.log:/var/log/apache2/error.log
  131.            - ./logs/apache_access.log:/var/log/apache2/access.log
  132.            - ./config/ssl/apache.key:/etc/apache2/ssl/apache.key
  133.            - ./config/ssl/apache.crt:/etc/apache2/ssl/apache.crt
  134.            # Below are shortcut paths to get to our projects in the container
  135.            - ./:/docker
  136.            - ./web/public_html/devsite:/devsite
  137.            - ./web/public_html/livesite:/livesite
  138.        restart: always
  139.        ports:
  140.            #Standard HTTP Port
  141.            - "80:80"
  142.            #Below allows access to local computer from outside ports
  143.            - "8080:80"
  144.            #SSH Port
  145.            - "443:443"
  146.            #Below allows access to local computer from outside ports
  147.            - "4443:443"
  148. #        extra_hosts:
  149. #            - "beta.poolservice.software:127.0.0.1"
  150. #            - "poolservice.software:127.0.0.1"
Add Comment
Please, Sign In to add comment