seperate frontend and backend into different containers

This commit is contained in:
GotPPay
2018-06-19 05:10:21 +02:00
parent 2535eb0d25
commit 90f80facb2
5 changed files with 23 additions and 78 deletions

10
backend.dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM php:7.0-apache
RUN docker-php-ext-install pdo pdo_mysql mysqli
RUN a2enmod rewrite
COPY docker/php/apache2.conf /etc/apache2/
COPY backend /var/www/html
RUN chown -R www-data:www-data /var/www/html

View File

@@ -1,20 +1,28 @@
version : '2'
services:
web:
backend:
build:
context: .
dockerfile: web.dockerfile
dockerfile: backend.dockerfile
volumes:
- ./log/web/:/var/log/apache2/
- ./log/backend/:/var/log/apache2/
ports:
- '8080:80'
- '8081:443'
- '8081:80'
depends_on:
- db
#use links keywoard to use db as a known host "db" to connect to database
links:
- db
frontend:
build:
context: .
dockerfile: frontend.dockerfile
volumens:
- ./log/frontend/:/var/log/apache2/
ports:
- '8080:80'
db:
build:

View File

@@ -1,32 +0,0 @@
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName localhost:8080/api-wiaas
ServerAdmin webmaster@localhost
DocumentRoot /var/www/backend
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@@ -1,32 +0,0 @@
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName localhost:8080
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@@ -8,15 +8,6 @@ RUN apt-get update && apt-get install -y git unzip gnupg
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
RUN docker-php-ext-install pdo pdo_mysql mysqli
RUN a2enmod rewrite
COPY docker/php/apache2.conf /etc/apache2/
COPY backend /var/www/html
RUN chown -R www-data:www-data /var/www/html
COPY frontend /home/wiaas/frontend
WORKDIR /home/wiaas/frontend