Merge pull request #16 from PootisPenserHere/qualityChangesToDocker

Quality changes to docker
This commit is contained in:
Jose Pablo Domingo Aramburo Sanchez 2018-08-11 20:07:07 -06:00 committed by GitHub
commit 6c91cad46c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 23 deletions

View File

@ -1 +1,2 @@
Options -Indexes Options -Indexes
Deny from all

View File

@ -1,10 +1,29 @@
# Stage 1 - the build process
FROM composer:1.7.1 as build-deps
ENV COMPOSER_ALLOW_SUPERUSER 1
WORKDIR /root
COPY . .
RUN composer install
RUN composer test
# Stage 2 - the production environment
FROM ubuntu:16.04 FROM ubuntu:16.04
# Updating
RUN apt-get -y update && apt-get -y upgrade RUN apt-get -y update && apt-get -y upgrade
# Installing php, apache and supplementary software RUN apt-get -y install apache2 \
RUN apt-get -y install apache2 php7.0 libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-mbstring php7.0-gd php7.0-intl php7.0-xml php7.0-mysql php7.0-mcrypt php7.0-zip curl git unzip composer php7.0 \
libapache2-mod-php7.0 \
php7.0-cli \
php7.0-common \
php7.0-mbstring \
php7.0-gd \
php7.0-intl \
php7.0-xml \
php7.0-mysql \
php7.0-mcrypt
# Enable apache mods # Enable apache mods
RUN a2enmod php7.0 RUN a2enmod php7.0
@ -20,24 +39,14 @@ ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2 ENV APACHE_LOCK_DIR /var/lock/apache2
# Expose apache
EXPOSE 80
# Copy this repo into place.
ADD . /var/www/site
WORKDIR /var/www/site WORKDIR /var/www/site
COPY --from=build-deps /root .
# Testing permisions RUN touch logs/app.log
RUN chmod 777 -R . RUN chmod 777 logs/app.log
# Installing dependencies # Update the default apache site
RUN composer install ADD docker/apache-config.conf /etc/apache2/sites-enabled/000-default.conf
# Unit tests # By default start up apache in the foreground
RUN composer test
# Update the default apache site with the config we created.
ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf
# By default start up apache in the foreground, override with /bin/bash for interative
CMD /usr/sbin/apache2ctl -D FOREGROUND CMD /usr/sbin/apache2ctl -D FOREGROUND

0
api-payroll/logs/app.log Executable file
View File

View File

@ -1,3 +1,5 @@
allow from all
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine On RewriteEngine On

View File

@ -6,7 +6,7 @@ services:
ports: ports:
- "8085:80" - "8085:80"
volumes: volumes:
- api-payroll:/var/www/site - ./volumes/apache-logs:/var/log/apache2
depends_on: depends_on:
- mysql - mysql
mysql: mysql:
@ -18,11 +18,11 @@ services:
ports: ports:
- "3307:3307" - "3307:3307"
volumes: volumes:
- my-datavolume:/var/lib/mysql - ./volumes/mysql-data:/var/lib/mysql
environment: environment:
MYSQL_ROOT_PASSWORD: '12345678' MYSQL_ROOT_PASSWORD: '12345678'
MYSQL_USER: 'sloth' MYSQL_USER: 'sloth'
MYSQL_PASS: '12345678' MYSQL_PASS: '12345678'
volumes: volumes:
api-payroll: mysql-data:
my-datavolume: apache-logs:

2
volumes/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
mysql-data/
apache-logs/

1
volumes/README.md Normal file
View File

@ -0,0 +1 @@
# Do not delete this directory, it'll contain the volumes created by the containers