Skip to content

Commit

Permalink
separate files voor apache config
Browse files Browse the repository at this point in the history
  • Loading branch information
AikedeJongste committed Mar 4, 2020
1 parent b2aef2e commit c605601
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 23 deletions.
63 changes: 40 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
FROM php:7.3.6-apache-stretch

HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl -f http://localhost:9000/ || exit 1

RUN docker-php-ext-install pdo pdo_mysql

# Install NPM
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install --yes nodejs git zip unzip && apt-get clean && rm -rf /var/lib/apt/lists

# Install Composer
RUN curl -sL https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php
RUN mv composer.phar /usr/bin/composer && chmod +x /usr/bin/composer

COPY httpd.conf /etc/apache2/sites-enabled/000-default.conf
COPY php.ini /usr/local/etc/php/php.ini
COPY wait-for-it.sh /usr/local/sbin/wait-for-it.sh

RUN chown -R www-data /var/www && chmod +x /usr/local/sbin/wait-for-it.sh

#CMD sed -i "s/80/9000/g" /etc/apache2/sites-enabled/000-default.conf /etc/apache2/ports.conf

EXPOSE 9000
FROM php:7-apache

ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_PID_FILE /var/run/apache2/apache2.pid
ENV APACHE_SERVER_NAME php-docker-base-linkorb

ENV APP_ENV=prod

COPY ./apache2.conf /etc/apache2/apache2.conf
COPY ./apache-vhost.conf /etc/apache2/sites-available/000-default.conf
COPY ./security.conf /etc/apache2/conf-available/security.conf \
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
COPY --from=composer /usr/bin/composer /usr/bin/composer

RUN apt-get update \
&& apt-get install -y --no-install-recommends git nodejs npm unzip zip \
&& install-php-extensions apcu gd gmp intl opcache pdo pdo_mysql sockets zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /app/config/secrets/dev \
&& mkdir -p /app/public/build \
&& chown -R www-data:www-data /app \
&& chown -R www-data:www-data /var/www \
&& a2enmod rewrite \
&& service apache2 restart

COPY --chown=www-data:www-data . /app

WORKDIR /app

USER root

#COPY docker/app-docker-entrypoint.sh /usr/local/bin/docker-entrypoint
#ENTRYPOINT ["docker-entrypoint"]

EXPOSE 80
CMD ["apache2-foreground"]
17 changes: 17 additions & 0 deletions apache-vhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<VirtualHost *:80>

ServerAdmin noc@linkorb.com

DocumentRoot /app/public

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory "/app/public">
FallbackResource "/index.php"
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>

</VirtualHost>
44 changes: 44 additions & 0 deletions apache2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf

<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>LinkORB Apache PHP container</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>LinkORB Apache PHP container</h1>
<p>If you see this page, the Apache web server is successfully installed and working.</p>
</body>
</html>

0 comments on commit c605601

Please sign in to comment.