Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Dockerfile fix #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM php:7.2-apache

WORKDIR /var/www/html

ARG USER

# Install essential packages
RUN apt-get update \
&& apt-get upgrade -y \
Expand Down Expand Up @@ -32,20 +34,6 @@ RUN wget http://codeception.com/codecept.phar \
&& chmod +x codecept.phar \
&& mv codecept.phar /usr/local/bin/codecept

RUN a2enmod rewrite

# Fix write permissions with shared folders
RUN usermod -u 1000 www-data

# Copy the working dir to the image's web root
COPY . /var/www/html
RUN mkdir -p /var/www/html/web/assets

# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
&& composer self-update
&& composer install --no-plugins --no-scripts

# Setup xdebug
RUN pecl install redis xdebug-2.6.0 \
&& docker-php-ext-enable xdebug \
Expand All @@ -56,4 +44,9 @@ RUN pecl install redis xdebug-2.6.0 \
&& echo "xdebug.remote_port=9999" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_host=192.168.99.1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

# Fix write permissions with shared folders
RUN a2enmod rewrite
RUN usermod -u 1000 www-data
RUN useradd -G www-data -m ${USER}

RUN echo "memory_limit=-1" >> /usr/local/etc/php/php.ini
26 changes: 16 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
version: '3.4'
version: '3'

services:
web:
build: ./
build:
context: .
dockerfile: ./Dockerfile
args:
- USER=${USER}
environment:
- USER=${USER}
ports:
- '${WEB_PORT:-8888}:80'
- ${WEB_PORT:-8888}:80
expose:
- '9000'
- 9000
volumes:
- ./:/var/www/html/
links:
- mysql

mysql:
image: mysql:5.7
container_name: 'yii2-mysql'
restart: 'always'
container_name: yii2-mysql
restart: always
ports:
- '${DB_PORT:-3306}:3306'
- ${DB_PORT:-3306}:3306
environment:
MYSQL_DATABASE: ${DB_NAME:-yii2}
MYSQL_USER: ${DB_USERNAME:-yii2}
Expand All @@ -28,13 +34,13 @@ services:

phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: 'yii2-phpmyadmin'
container_name: yii2-phpmyadmin
links:
- mysql
environment:
PMA_HOST: mysql
PMA_PORT: '${DB_PORT:-3306}:3306'
PMA_PORT: ${DB_PORT:-3306}:3306
ports:
- '${PHPMA_PORT:-8080}:80'
- ${PHPMA_PORT:-8080}:80
volumes:
- /sessions