Skip to content

Instantly share code, notes, and snippets.

@Artem-Schander
Forked from anonymous/app.dockerfile
Last active August 31, 2018 15:53
Show Gist options
  • Save Artem-Schander/03e0e7db372a04c7ebfac34a61008125 to your computer and use it in GitHub Desktop.
Save Artem-Schander/03e0e7db372a04c7ebfac34a61008125 to your computer and use it in GitHub Desktop.
FROM php:7.2-fpm
RUN export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS"
RUN apt-get update && apt-get install -y --no-install-recommends \
libmcrypt-dev mysql-client libmagickwand-dev git zip \
ghostscript imagemagick libmagickwand-dev \
&& rm -rf /var/lib/apt/lists/*
RUN pecl install imagick mcrypt-1.0.1 \
&& docker-php-ext-enable imagick mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install pdo_mysql zip gd
COPY php.ini /usr/local/etc/php/
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN chown www-data:www-data /var/www
version: '2'
services:
# The Application
app:
build:
context: ./
dockerfile: app.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www
environment:
DB_PORT: 3306
DB_HOST: database
# The Web Server
web:
build:
context: ./
dockerfile: web.dockerfile
working_dir: /var/www
volumes_from:
- app
ports:
- 80:80
# The Database
database:
build:
context: ./
dockerfile: mysql.dockerfile
volumes:
- dbdata:/var/lib/mysql
environment:
MYSQL_DATABASE: database
MYSQL_USER: user
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
ports:
- 3306:3306
volumes:
dbdata:
[mysqld]
max_connections=1024
FROM mysql:5.6
ADD mysql.cnf /etc/mysql/conf.d/mysql.cnf
memory_limit=1G
server {
listen 80;
index index.php index.html;
root /var/www/public;
client_max_body_size 20M;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
FROM nginx:1.10
ADD vhost.conf /etc/nginx/conf.d/default.conf
@Artem-Schander
Copy link
Author

composer or artisan commands can be executed through the app container
Fa. docker-compose exec app php artisan migrate:refresh --seed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment