-
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.
Merge pull request #1141 from linuxjuggler/feature/docker-dev
Feature/docker dev
- Loading branch information
Showing
5 changed files
with
96 additions
and
8 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM zaherg/php-and-nginx-xdebug:latest | ||
FROM zaherg/php-and-nginx:latest | ||
|
||
ARG BUILD_DATE | ||
ARG DOCKER_REPO | ||
|
@@ -7,7 +7,7 @@ ARG IMAGE_NAME | |
ARG VERSION | ||
|
||
LABEL Maintainer="Zaher Ghaibeh <[email protected]>" \ | ||
Description="This is the docker image for OpenCFP." \ | ||
Description="This is the docker image for OpenCFP, a PHP-based conference talk submission system." \ | ||
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 \ | ||
|
@@ -20,7 +20,6 @@ LABEL Maintainer="Zaher Ghaibeh <[email protected]>" \ | |
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 | ||
|
||
|
@@ -29,10 +28,11 @@ RUN set -ex \ | |
&& 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 && \ | ||
sed -i "s/#gzip on;/gzip on;/" /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 "upload_max_filesize = 120M" >> /usr/local/etc/php/php.ini && \ | ||
echo "post_max_size = 120M" >> /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 && \ | ||
|
@@ -41,7 +41,7 @@ RUN set -ex \ | |
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 && \ | ||
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 && \ | ||
|
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,75 @@ | ||
# [](https://github.com/opencfp/opencfp) | ||
|
||
OpenCFP is a PHP-based conference talk submission system. | ||
|
||
--- | ||
## Using Docker for Development | ||
|
||
Now that we have [Docker](https://docker.com) image that we can build, it is easy for us to setup a docker | ||
development environment, you need to follow the following steps: | ||
|
||
* You need to create a new `docker-compose.yml` file from our `docker-compos.yml.dist` file. | ||
|
||
* Modify the `app.environment` section to look like the following: | ||
|
||
``` | ||
environment: | ||
- "CFP_ENV=development" | ||
- "CFP_DB_HOST=database" | ||
- "CFP_DB_PASS=root" | ||
``` | ||
|
||
* Modify the `app.volumes` section to look like the following: | ||
|
||
``` | ||
volumes: | ||
- ./:/var/www | ||
- ./config/docker.yml.dist:/var/www/config/development.yml | ||
- ./.docker/script:/var/www/script | ||
``` | ||
|
||
The most important section is the `app.volumes` section, as it will make sure that we share our code with the docker | ||
container. | ||
|
||
The following, will create a shared volume with the container, so any file you create in your code will automatically | ||
copied over to the container. | ||
|
||
``` | ||
- ./:/var/www | ||
``` | ||
|
||
Meanwhile, The following will create a copy from our `docker.yml.dist` file and call it `development.yml` file within | ||
the container, you can remove this line and create your own `.yml` file. | ||
|
||
``` | ||
- ./config/docker.yml.dist:/var/www/config/development.yml | ||
``` | ||
|
||
The last part, is the important one, as the scripts was written in `bash` mean while the docker image depends on `alpine` | ||
to make sure it has a small size (about **270MB** in total), so we needs to copy over the docker specific files to the | ||
container, and replace the one on the container. | ||
|
||
``` | ||
- ./.docker/script:/var/www/script | ||
``` | ||
|
||
This will not overwrite the original `script` files, but will make our liver easier and will make the scripts | ||
compatible with `sh`. | ||
|
||
## Run Docker | ||
|
||
Now all you have to do is to run the following command: | ||
|
||
``` | ||
$ docker-compose up -d | ||
``` | ||
|
||
Which will automatically build the images for your if its not already built. | ||
|
||
and to stop your containers you can run: | ||
|
||
``` | ||
$ docker-compose down | ||
``` | ||
|
||
_PS_: You can access MySQL in the same way we described in the Docker section. |
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