This repository has been archived by the owner on Dec 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge develop into database-improvements-#21
- Loading branch information
Showing
20 changed files
with
171 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ | |
/tests/logs | ||
error_log | ||
phpcs.xml | ||
phpunit.xml | ||
phpunit.xml | ||
docker-compose.override.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,26 @@ | ||
FROM php:7.0-apache | ||
FROM php:7.0-fpm-alpine | ||
|
||
LABEL maintainer "tdmalone@gmail.com" | ||
|
||
COPY . /var/www/html | ||
WORKDIR /var/www/html | ||
ENV PROJECT_ROOT /slackemon | ||
|
||
# Create a user | ||
RUN useradd -ms /bin/bash slackemon | ||
COPY . $PROJECT_ROOT | ||
WORKDIR $PROJECT_ROOT | ||
|
||
# Assign it to www-data | ||
RUN usermod -a -G www-data slackemon | ||
|
||
# Assign public_html to www-data | ||
RUN chown -R www-data:www-data /var/www/html | ||
|
||
# Change permission to only user and group www-data | ||
RUN chmod -R 774 /var/www/html | ||
RUN addgroup -g 1000 slackemon && \ | ||
adduser -u 1000 -G slackemon -s /bin/sh -D slackemon && \ | ||
chown -R slackemon:slackemon $PROJECT_ROOT && \ | ||
chmod -R 774 $PROJECT_ROOT | ||
|
||
# Install git and zip, used by Composer; cron, nano, vim and finally postgres functions for PHP7 | ||
RUN apt-get update && apt-get install git zlib1g-dev cron nano vim libpq-dev -y && \ | ||
RUN apk --no-cache add git zlib-dev nano vim postgresql-dev && \ | ||
docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql && \ | ||
docker-php-ext-install zip pdo pdo_pgsql pgsql | ||
|
||
# Install the Composer package manager | ||
# Install Composer package manager | ||
RUN curl -s http://getcomposer.org/installer | php | ||
|
||
USER slackemon | ||
|
||
# Install dependencies as non-root | ||
# Install dependencies | ||
RUN php composer.phar install | ||
|
||
# Separate container vendor from local vendor | ||
VOLUME /var/www/html/vendor | ||
|
||
# Use root to start the server | ||
USER root | ||
|
||
# Set up the cron job every minute, with the correct environment | ||
# then, start apache2 in foreground (https://github.com/docker-library/php/blob/76a1c5ca161f1ed6aafb2c2d26f83ec17360bc68/7.1/apache/Dockerfile#L205) | ||
CMD printenv > /etc/environment && \ | ||
echo "* * * * * /usr/local/bin/php /var/www/html/cron.php" | crontab - && \ | ||
cron && \ | ||
apache2-foreground |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version: "2" | ||
services: | ||
php: | ||
image: tdmalone/slackemon | ||
restart: always | ||
volumes: | ||
- ./:/slackemon | ||
env_file: | ||
- .env | ||
|
||
webserver: | ||
image: nginx:alpine | ||
restart: always | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- ./:/slackemon | ||
- ./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf | ||
|
||
database: | ||
image: postgres:alpine | ||
restart: always | ||
expose: | ||
- "5432" | ||
volumes: | ||
- db_data:/var/lib/postgresql/data | ||
environment: | ||
- PGDATA=/var/lib/postgresql/data/pgdata | ||
env_file: | ||
- .env | ||
|
||
cronjob: | ||
image: appropriate/curl | ||
restart: always | ||
volumes: | ||
- ./etc/crond/root:/var/spool/cron/crontabs/root | ||
command: crond -f | ||
|
||
# Local volume where to store data | ||
# in a persistent way | ||
volumes: | ||
db_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* * * * * curl webserver/cron.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
server { | ||
listen 80; | ||
index index.php index.html; | ||
server_name localhost; | ||
error_log /var/log/nginx/error.log; | ||
access_log /var/log/nginx/access.log; | ||
root /slackemon; | ||
|
||
location ~ /\. { | ||
deny all; | ||
} | ||
|
||
location ~ \.php$ { | ||
try_files $uri =404; | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_pass php:9000; | ||
fastcgi_index index.php; | ||
include fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_param PATH_INFO $fastcgi_path_info; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.