Skip to content

Instantly share code, notes, and snippets.

@msuryaprakash
Forked from michaelneu/Dockerfile
Created December 4, 2020 21:39
Show Gist options
  • Save msuryaprakash/f7f0123d21fd5f2358d28699f2bca601 to your computer and use it in GitHub Desktop.
Save msuryaprakash/f7f0123d21fd5f2358d28699f2bca601 to your computer and use it in GitHub Desktop.

Revisions

  1. @michaelneu michaelneu revised this gist Mar 18, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ It includes the following:
    - place `.php` files into a directory named *"code"* for them to be executable
    - sendmail
    - MailDev
    - you might want to adjust the root mail address in `Dockerfile:10`
    - you might want to adjust the root mail address in `Dockerfile:17`
    - port [8081](http://localhost:8081)
    - MySQL
    - you also might want to adjust the default password (which is *"password"*) in `docker-compose.yml`
  2. @michaelneu michaelneu revised this gist Jul 15, 2018. 3 changed files with 19 additions and 7 deletions.
    23 changes: 16 additions & 7 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,24 @@
    # see https://github.com/cmaessen/docker-php-sendmail for more information

    FROM php:fpm
    FROM php:5-fpm

    RUN apt-get update && apt-get install -q -y ssmtp mailutils && rm -rf /var/lib/apt/lists/*

    RUN docker-php-ext-install mysql mysqli
    RUN docker-php-ext-install mysql mysqli sysvsem

    RUN echo "hostname=localhost.localdomain" > /etc/ssmtp/ssmtp.conf
    RUN echo "[email protected]" >> /etc/ssmtp/ssmtp.conf
    RUN echo "mailhub=maildev" >> /etc/ssmtp/ssmtp.conf
    RUN pecl install xdebug-2.5.5 \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
    && echo "[XDebug]" >> /usr/local/etc/php/conf.d/xdebug.ini \
    && echo "xdebug.remote_log=/tmp/xdebug.log" >> /usr/local/etc/php/conf.d/xdebug.ini \
    && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
    && echo "xdebug.remote_autostart=on" >> /usr/local/etc/php/conf.d/xdebug.ini

    RUN echo "sendmail_path=sendmail -i -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini
    RUN echo "hostname=localhost.localdomain" > /etc/ssmtp/ssmtp.conf \
    && echo "root=root@localhost" >> /etc/ssmtp/ssmtp.conf \
    && echo "mailhub=maildev" >> /etc/ssmtp/ssmtp.conf \
    && echo "sendmail_path=sendmail -i -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini

    RUN echo "localhost localhost.localdomain" >> /etc/hosts
    RUN echo "[Date]" >> /usr/local/etc/php/conf.d/php-sendmail.ini \
    && echo "date.timezone = Europe/Amsterdam" >> /usr/local/etc/php/conf.d/php-sendmail.ini

    RUN echo "localhost localhost.localdomain" >> /etc/hosts
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,7 @@ It includes the following:
    - port [8080](http://localhost:8080)
    - PHP
    - FPM configured for NGINX
    - XDebug connecting to the docker host
    - place `.php` files into a directory named *"code"* for them to be executable
    - sendmail
    - MailDev
    2 changes: 2 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,8 @@ php:
    build: .
    volumes:
    - ./code:/code
    environment:
    XDEBUG_CONFIG: remote_host=host.docker.internal
    links:
    - mysql
    - maildev
  3. @michaelneu michaelneu created this gist Feb 18, 2017.
    15 changes: 15 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # see https://github.com/cmaessen/docker-php-sendmail for more information

    FROM php:fpm

    RUN apt-get update && apt-get install -q -y ssmtp mailutils && rm -rf /var/lib/apt/lists/*

    RUN docker-php-ext-install mysql mysqli

    RUN echo "hostname=localhost.localdomain" > /etc/ssmtp/ssmtp.conf
    RUN echo "[email protected]" >> /etc/ssmtp/ssmtp.conf
    RUN echo "mailhub=maildev" >> /etc/ssmtp/ssmtp.conf

    RUN echo "sendmail_path=sendmail -i -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini

    RUN echo "localhost localhost.localdomain" >> /etc/hosts
    22 changes: 22 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    ## docker-compose configuration

    This configuration basically resembles a mix of [cmaessen's docker-php-sendmail](https://github.com/cmaessen/docker-php-sendmail) project and [mikechernev's NGINX configuration](https://github.com/mikechernev/dockerised-php).

    It includes the following:

    - NGINX
    - port [8080](http://localhost:8080)
    - PHP
    - FPM configured for NGINX
    - place `.php` files into a directory named *"code"* for them to be executable
    - sendmail
    - MailDev
    - you might want to adjust the root mail address in `Dockerfile:10`
    - port [8081](http://localhost:8081)
    - MySQL
    - you also might want to adjust the default password (which is *"password"*) in `docker-compose.yml`
    - port 3306
    - phpmyadmin
    - defaults see `docker-compose.yml`, also consider changing the password here too
    - port [8082](http://localhost:8082)

    40 changes: 40 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    web:
    image: nginx:latest
    ports:
    - "8080:80"
    volumes:
    - ./code:/code
    - ./nginx.conf:/etc/nginx/conf.d/default.conf
    links:
    - php

    php:
    build: .
    volumes:
    - ./code:/code
    links:
    - mysql
    - maildev

    mysql:
    image: mysql:latest
    ports:
    - "3306:3306"
    environment:
    - MYSQL_ROOT_PASSWORD=password

    phpmyadmin:
    image: phpmyadmin/phpmyadmin
    links:
    - mysql:db
    ports:
    - "8082:80"
    environment:
    - PMA_USER=root
    - PMA_PASSWORD=password
    - PHP_UPLOAD_MAX_FILESIZE=100MB

    maildev:
    image: djfarrelly/maildev
    ports:
    - "8081:80"
    19 changes: 19 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # see https://github.com/mikechernev/dockerised-php for more information

    server {
    index index.php index.html;
    server_name php-docker.local;
    error_log /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /code;

    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass php:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    }
    }