-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding the ability to build a docker image
- Loading branch information
Showing
9 changed files
with
270 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
FROM zaherg/php-and-nginx-xdebug:latest | ||
|
||
ARG BUILD_DATE | ||
ARG DOCKER_REPO | ||
ARG VCS_REF | ||
ARG IMAGE_NAME | ||
ARG VERSION | ||
|
||
LABEL Maintainer="Zaher Ghaibeh <[email protected]>" \ | ||
Description="This is the docker image for OpenCFP." \ | ||
org.label-schema.name=$IMAGE_NAME \ | ||
org.label-schema.description="This is the docker image for OpenCFP, a PHP-based conference talk submission system." \ | ||
org.label-schema.build-date=$BUILD_DATE \ | ||
org.label-schema.vcs-url="https://github.com/opencfp/opencfp.git" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vendor="OpenCFP" \ | ||
org.label-schema.version=$VERSION \ | ||
org.label-schema.schema-version="1.0.0" | ||
|
||
ENV CFP_ENV ${CFP_ENV:-development} | ||
ENV CFP_DB_HOST ${CFP_DB_HOST:-"127.0.0.1"} | ||
ENV CFP_DB_PASS ${CFP_DB_PASS:-root} | ||
ENV PHP_XDEBUG_DEFAULT_ENABLE ${PHP_XDEBUG_DEFAULT_ENABLE:-0} | ||
|
||
COPY ./ /var/www | ||
|
||
RUN set -ex \ | ||
&& sed -i "s/access_log logs\/access.log main;/access_log \/var\/log\/nginx\/access.cfp.log; error_log \/var\/log\/nginx\/error.cfp.log;/" /etc/nginx/nginx.conf \ | ||
&& sed -i "s/\/web\/html/\/var\/www\/web/" /etc/nginx/nginx.conf && \ | ||
sed -i "s/localhost/_/" /etc/nginx/nginx.conf && \ | ||
sed -i "s/#user nobody;/user www-data;/" /etc/nginx/nginx.conf && \ | ||
touch /usr/local/etc/php/php.ini && \ | ||
echo "cgi.fix_pathinfo=0" >> /usr/local/etc/php/php.ini && \ | ||
echo "upload_max_filesize = 30M" >> /usr/local/etc/php/php.ini && \ | ||
echo "post_max_size = 30M" >> /usr/local/etc/php/php.ini && \ | ||
echo "memory_limit = 512M" >> /usr/local/etc/php/php.ini && \ | ||
echo 'variables_order = "EGPCS"' >> /usr/local/etc/php/php.ini && \ | ||
sed -i -e "s/;catch_workers_output\s*=\s*yes/catch_workers_output = yes/g" /usr/local/etc/php-fpm.d/www.conf && \ | ||
sed -i -e "s/pm.max_children = 5/pm.max_children = 9/g" /usr/local/etc/php-fpm.d/www.conf && \ | ||
sed -i -e "s/pm.start_servers = 2/pm.start_servers = 3/g" /usr/local/etc/php-fpm.d/www.conf && \ | ||
sed -i -e "s/pm.min_spare_servers = 1/pm.min_spare_servers = 2/g" /usr/local/etc/php-fpm.d/www.conf && \ | ||
sed -i -e "s/pm.max_spare_servers = 3/pm.max_spare_servers = 4/g" /usr/local/etc/php-fpm.d/www.conf && \ | ||
sed -i -e "s/pm.max_requests = 500/pm.max_requests = 200/g" /usr/local/etc/php-fpm.d/www.conf && \ | ||
mkdir /var/www/cache && \ | ||
mkdir -p /var/www/cache/testing/sessions /var/www/cache/production/sessions /var/www/cache/development/sessions \ | ||
/var/www/cache/testing/twig /var/www/cache/production/twig /var/www/cache/development/twig && \ | ||
chgrp -R www-data /var/lib/nginx /var/www/web/uploads /var/www/cache /var/www/log && \ | ||
chmod -R ug+rwx /var/lib/nginx /var/www/web/uploads /var/www/cache /var/www/log && \ | ||
cp /var/www/config/$CFP_ENV.yml.dist /var/www/config/$CFP_ENV.yml && \ | ||
rm -fr /var/www/html /var/www/localhost | ||
|
||
COPY ./.docker/script/ /var/www/script/ | ||
|
||
WORKDIR /var/www | ||
|
||
RUN composer global require hirak/prestissimo && \ | ||
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader |
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,20 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
echo "Build hook running" | ||
|
||
TAG=$1 | ||
|
||
export COMMIT_HASH=`git rev-parse --short HEAD` | ||
|
||
export IMAGE_COMMIT=opencfp/opencfp:$TAG-$COMMIT_HASH | ||
|
||
export IMAGE_NAME=opencfp/opencfp:$TAG && \ | ||
docker build --no-cache --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ | ||
--file ./.docker/Dockerfile \ | ||
--build-arg VCS_REF=$COMMIT_HASH \ | ||
--build-arg DOCKER_REPO=$DOCKER_REPO \ | ||
--build-arg VERSION=$BITBUCKET_BUILD_NUMBER \ | ||
--build-arg IMAGE_NAME=$IMAGE_NAME \ | ||
--squash --force-rm --compress --rm \ | ||
-t $IMAGE_NAME . |
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,26 @@ | ||
#!/usr/bin/env sh | ||
|
||
# script/bootstrap: Resolve all dependencies that the application requires to run. | ||
|
||
set -e | ||
|
||
cd "$(dirname "$0")/.." | ||
|
||
if [ "$CFP_ENV" = "" ]; then | ||
export CFP_ENV="development" | ||
fi | ||
|
||
echo "==> Installing dependencies..." | ||
if command -v composer &>/dev/null; then | ||
composer install | ||
elif [ -f "composer.phar" ]; then | ||
php composer.phar install | ||
else | ||
echo "ERROR: Composer path unknown. Please install composer or download composer.phar" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f "config/$CFP_ENV.yml" ]; then | ||
echo "Missing config/$CFP_ENV.yml, be sure to copy from config/$CFP_ENV.yml.dist and update config" | ||
exit 1 | ||
fi |
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,19 @@ | ||
#!/usr/bin/env sh | ||
|
||
# script/setup: Set up application for the first time after cloning, or set it | ||
# back to the initial first unused state. | ||
|
||
set -e | ||
|
||
cd "$(dirname "$0")/.." | ||
|
||
script/bootstrap | ||
|
||
if [ "$CFP_ENV" = "" ]; then | ||
export CFP_ENV="development" | ||
fi | ||
|
||
echo "==> Setting up DB..." | ||
php vendor/bin/phinx migrate -e $CFP_ENV | ||
|
||
echo "==> App is now ready to go!" |
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,21 @@ | ||
#!/usr/bin/env sh | ||
|
||
# script/test: Run test suite for application. Optionally pass in a path to an | ||
# individual test file to run a single test. | ||
|
||
|
||
set -e | ||
|
||
cd "$(dirname "$0")/.." | ||
|
||
script/bootstrap | ||
|
||
echo "==> Creating test db..." | ||
export CFP_ENV=testing && php vendor/bin/phinx --configuration=phinx.php migrate | ||
|
||
if [ ! -f "phpunit.xml" ]; then | ||
cp phpunit.xml.dist phpunit.xml | ||
fi | ||
|
||
echo "==> Running tests..." | ||
php vendor/bin/phpunit |
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,20 @@ | ||
#!/usr/bin/env sh | ||
|
||
# script/update: Update application to run for its current checkout. | ||
|
||
set -e | ||
|
||
cd "$(dirname "$0")/.." | ||
|
||
script/bootstrap | ||
|
||
if [ "$CFP_ENV" = "" ]; then | ||
export CFP_ENV="development" | ||
fi | ||
|
||
echo "==> Clearing cache..." | ||
php bin/console cache:clear | ||
|
||
echo "==> Updating db..." | ||
# run all database migrations to ensure everything is up to date. | ||
php vendor/bin/phinx migrate -e $CFP_ENV |
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,5 @@ | ||
vendor | ||
node_modules | ||
.git | ||
.travis | ||
.travis.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
application: | ||
title: OpenCFP | ||
url: http://cfp.dev | ||
email: [email protected] | ||
eventurl: http://myenvent.com | ||
event_location: Miami, FL | ||
enddate: Oct. 14th, 2100 | ||
show_submission_count: false | ||
airport: MIA | ||
arrival: 2018-10-26 | ||
departure: 2018-10-31 | ||
secure_ssl: true | ||
online_conference: false | ||
date_format: d/m/Y | ||
date_timezone: "UTC" | ||
coc_link: http://confcodeofconduct.com/ | ||
show_contrib_banner: true | ||
venue_image_path: /assets/img/venue.jpg | ||
|
||
database: | ||
host: database | ||
database: cfp | ||
dsn: mysql:dbname=cfp;host=database | ||
user: root | ||
password: root | ||
|
||
log: | ||
level: error | ||
|
||
mail: | ||
host: ~ | ||
port: ~ | ||
username: ~ | ||
password: ~ | ||
encryption: ~ | ||
auth_mode: ~ | ||
|
||
talk: | ||
categories: | ||
api: APIs (REST, SOAP, etc.) | ||
continuousdelivery: Continuous Delivery | ||
database: Database | ||
development: Development | ||
devops: Devops | ||
framework: Framework | ||
ibmi: IBMi | ||
javascript: JavaScript | ||
personal: Personal Skills | ||
security: Security | ||
testing: Testing | ||
uiux: UI/UX | ||
other: Other | ||
levels: | ||
entry: Entry level | ||
mid: Mid-level | ||
advanced: Advanced | ||
types: | ||
regular: Regular (50 mins) | ||
tutorial: Tutorial (3 hrs) | ||
|
||
security: | ||
firewalls: | ||
secured_area: | ||
form_forgot: | ||
csrf_parameter: _csrf_security_token | ||
csrf_token_id: forgot_password | ||
|
||
reviewer: | ||
users: | ||
- |
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,32 @@ | ||
version : "3.4" | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: ./.docker/Dockerfile | ||
image: opencfp/opencfp | ||
environment: | ||
- "CFP_ENV=production" | ||
- "CFP_DB_HOST=database" | ||
- "CFP_DB_PASS=root" | ||
volumes: | ||
- ./config/docker.yml.dist:/var/www/config/production.yml | ||
ports: | ||
- "80:80" | ||
networks: | ||
- backend | ||
|
||
database: | ||
image: mysql:5.7 | ||
environment: | ||
- "MYSQL_DATABASE=cfp" | ||
- "MYSQL_ROOT_PASSWORD=root" | ||
ports: | ||
- "3306:3306" | ||
networks: | ||
- backend | ||
|
||
|
||
networks: | ||
backend: |