Last active
September 20, 2017 22:55
-
-
Save neohunter/090c9da3fa5b6d84721988772ad92a3d to your computer and use it in GitHub Desktop.
ejemplo de docker con php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cree estos directorios en donde tiene su app: | |
# docker | |
# mysql | |
# mysql_data (vacio) | |
# mysql_init | |
# initial.sql (puede estar en gz) o si quiere no existir, es la db por defecto | |
# php | |
# php-overrides.ini # cualquier configuracion del php.ini que quiera | |
# ejecutar | |
# docker-compose up | |
# e ir a: | |
# http://localhost:8180 | |
# docker-compose.yml | |
# Esto es para atrapar todos los emails, puede acceder por http://localhost:8125 | |
jothan-mailhog: | |
image: phpdockerio/mailhog:latest | |
container_name: jothan-mailhog | |
ports: | |
- "8125:8025" | |
# esta es la instancia de mysql, puede acceder con localhost:8106 | |
jothan-mysql: | |
image: mysql:5.7 | |
container_name: jothan-mysql | |
volumes: | |
- ./docker/mysql_data:/var/lib/mysql | |
- ./docker/mysql_init:/docker-entrypoint-initdb.d | |
ports: | |
- "8106:3306" | |
environment: | |
- MYSQL_ROOT_PASSWORD=root | |
- MYSQL_DATABASE=jothan | |
- MYSQL_USER=jothan | |
- MYSQL_PASSWORD=jothan | |
command: mysqld --sql_mode="" | |
# este construye a partir del Dockerfile | |
jothan-php: | |
build: . | |
container_name: jothan-php | |
ports: | |
- "8180:80" | |
volumes: | |
- ./:/var/www/html | |
- ./docker/php/php-overrides.ini:/usr/local/etc/php/conf.d/99-overrides.ini | |
links: | |
- jothan-mailhog | |
- jothan-mysql | |
# Dockerfile | |
# usamos php con apache, y le metemos mysqli | |
FROM php:5.6.31-apache | |
RUN apt-get update \ | |
&& apt-get -y --no-install-recommends install php5-mysql \ | |
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* | |
RUN \ | |
a2enmod rewrite \ | |
&& docker-php-ext-install mysqli \ | |
&& docker-php-ext-install pdo_mysql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment