initial docker commit - working

This commit is contained in:
Th3R3p0 2017-08-22 21:30:42 -04:00
parent bd34454758
commit 17b8bfa90c
5 changed files with 60 additions and 0 deletions

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM php:7.0-apache
COPY htdocs /var/www/html
COPY htdocs/application/config/stikked.php.dist /var/www/html/application/config/stikked.php
COPY replace-envvars.sh /bin/
COPY docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-entrypoint
EXPOSE 80
RUN a2enmod rewrite
RUN docker-php-ext-install mysqli

24
docker-compose.yml Normal file
View File

@ -0,0 +1,24 @@
version: '3'
services:
db:
image: mysql:latest
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 1
MYSQL_DATABASE: stikked
MYSQL_USER: stikked
MYSQL_PASSWORD: stikked
stikked:
depends_on:
- db
image: stikked
env_file:
stikked-envvars.txt
ports:
- 80:80
volumes:
db_data:

12
docker-php-entrypoint Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e
# custom script to overwrite stikked config variables
bash /bin/replace-envvars.sh
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php "$@"
fi
exec "$@"

7
replace-envvars.sh Normal file
View File

@ -0,0 +1,7 @@
sed -i "s/\['site_name'\].*/['site_name'] = '$SITENAME';/" /var/www/html/application/config/stikked.php
sed -i "s/\['base_url'\].*/['base_url'] = '$BASEURL';/" /var/www/html/application/config/stikked.php
sed -i "s/\['db_hostname'\].*/['db_hostname'] = '$DBHOST';/" /var/www/html/application/config/stikked.php
sed -i "s/\['db_database'\].*/['db_database'] = '$DBNAME';/" /var/www/html/application/config/stikked.php
sed -i "s/\['db_username'\].*/['db_username'] = '$DBUSER';/" /var/www/html/application/config/stikked.php
sed -i "s/\['db_password'\].*/['db_password'] = '$DBPASS';/" /var/www/html/application/config/stikked.php
sed -i "s/\['enable_captcha'\].*/['enable_captcha'] = '$CAPTHCA';/" /var/www/html/application/config/stikked.php

7
stikked-envvars.txt Normal file
View File

@ -0,0 +1,7 @@
SITENAME=Stikked
BASEURL=http:\/\/stikked.local\/
DBHOST=db
DBNAME=stikked
DBUSER=stikked
DBPASS=stikked
CAPTCHA=false