mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-09 17:42:21 +03:00
Docker image based on official PHP-apache distribution. Some configuration tweaks to support it
This commit is contained in:
parent
547bad01f1
commit
2d3e03f54c
6 changed files with 26 additions and 28 deletions
4
.env
4
.env
|
@ -1,10 +1,10 @@
|
||||||
DB_USERNAME=easyapp
|
DB_USERNAME=easyapp
|
||||||
DB_NAME=easyapp
|
DB_NAME=easyapp
|
||||||
|
|
||||||
# before deploying to production change to harder password
|
# before deploying to production change to harder password, and don't commit it to git
|
||||||
DB_PASSWORD=veryhardpassword
|
DB_PASSWORD=veryhardpassword
|
||||||
|
|
||||||
# change to you installation address
|
# change to your installation address
|
||||||
APP_URL=localhost
|
APP_URL=localhost
|
||||||
APP_HOST=0.0.0.0
|
APP_HOST=0.0.0.0
|
||||||
APP_PORT=80
|
APP_PORT=80
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
FROM wichon/alpine-apache-php
|
FROM php:7.0-apache
|
||||||
|
|
||||||
ENV PROJECT_DIR=/app \
|
ENV PROJECT_DIR=/var/www/html \
|
||||||
APP_URL=localhost
|
APP_URL=localhost
|
||||||
|
|
||||||
RUN apk --no-cache add php-zlib php-mysqli php-gettext
|
RUN docker-php-ext-install mysqli gettext
|
||||||
|
|
||||||
COPY ./src $PROJECT_DIR
|
COPY ./src $PROJECT_DIR
|
||||||
COPY docker-entrypoint.sh /entrypoint.sh
|
COPY docker-entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
VOLUME $PROJECT_DIR/storage
|
VOLUME $PROJECT_DIR/storage
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
|
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||||
CMD ["run"]
|
CMD ["run"]
|
||||||
|
|
11
README.md
11
README.md
|
@ -44,7 +44,7 @@ You can also report problems on the [issues page](https://github.com/alextselegi
|
||||||
and help the development progress.
|
and help the development progress.
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
To start Easy!Appointments using Docker in development configuration with source files mounted into container, run:
|
To start Easy!Appointments using Docker in development configuration, with source files mounted into container, run:
|
||||||
```
|
```
|
||||||
docker-compose up
|
docker-compose up
|
||||||
```
|
```
|
||||||
|
@ -53,7 +53,14 @@ Production deployment can be made by changing required values in .env file (DB_P
|
||||||
```
|
```
|
||||||
docker-compose -f docker-compose.prod.yml up -d
|
docker-compose -f docker-compose.prod.yml up -d
|
||||||
```
|
```
|
||||||
Database data will be stored in named volume "easy-appointments-data", and app storage (logs, cache, uploads) in "easy-appointments-data".
|
|
||||||
|
Database data will be stored in named volume `easyappointments_easy-appointments-data`, and app storage (logs, cache, uploads) in `easyappointments_easy-appointments-storage`.
|
||||||
|
To find where exactly they are stored, you can run
|
||||||
|
```
|
||||||
|
docker volume inspect easyappointments_easy-appointments-storage
|
||||||
|
```
|
||||||
|
|
||||||
|
Production containers will automatically be restarted in case of crash / server reboot. For more info, take a look into `docker-compose.prod.yml` file.
|
||||||
|
|
||||||
### User Feedback
|
### User Feedback
|
||||||
Whether it is new ideas or defects, your feedback is highly appreciated and will be taken into
|
Whether it is new ideas or defects, your feedback is highly appreciated and will be taken into
|
||||||
|
|
|
@ -23,7 +23,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- easy-appointments-storage:/app/src/storage
|
- easy-appointments-storage:/var/www/html/src/storage
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -13,13 +13,15 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
volumes:
|
volumes:
|
||||||
- ./src:/app
|
- ./src:/var/www/html
|
||||||
command: dev
|
command: dev
|
||||||
ports:
|
ports:
|
||||||
- ${APP_HOST}:80:80
|
- ${APP_HOST}:80:80
|
||||||
environment:
|
environment:
|
||||||
- DB_HOST=database:3306
|
- DB_HOST=database:3306
|
||||||
- APP_URL=localhost
|
- APP_URL=localhost
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
restart: always
|
restart: always
|
||||||
|
|
|
@ -6,7 +6,7 @@ createAppSettings() {
|
||||||
sed -i "s/DB_USERNAME = ''/DB_USERNAME = '$DB_USERNAME'/g" $PROJECT_DIR/config.php
|
sed -i "s/DB_USERNAME = ''/DB_USERNAME = '$DB_USERNAME'/g" $PROJECT_DIR/config.php
|
||||||
sed -i "s/DB_PASSWORD = ''/DB_PASSWORD = '$DB_PASSWORD'/g" $PROJECT_DIR/config.php
|
sed -i "s/DB_PASSWORD = ''/DB_PASSWORD = '$DB_PASSWORD'/g" $PROJECT_DIR/config.php
|
||||||
sed -i "s/DB_NAME = ''/DB_NAME = '$DB_NAME'/g" $PROJECT_DIR/config.php
|
sed -i "s/DB_NAME = ''/DB_NAME = '$DB_NAME'/g" $PROJECT_DIR/config.php
|
||||||
if [ "$EMAIL_PROTOCOL" == "smtp" ]; then
|
if [ "$EMAIL_PROTOCOL" = "smtp" ]; then
|
||||||
echo "Setting up email..."
|
echo "Setting up email..."
|
||||||
sed -i "s/\$config\['protocol'\] = 'mail'/\$config['protocol'] = 'smtp'/g" $PROJECT_DIR/application/config/email.php
|
sed -i "s/\$config\['protocol'\] = 'mail'/\$config['protocol'] = 'smtp'/g" $PROJECT_DIR/application/config/email.php
|
||||||
sed -i "s#// \$config\['smtp_host'\] = ''#\$config['smtp_host'] = '$SMTP_HOST'#g" $PROJECT_DIR/application/config/email.php
|
sed -i "s#// \$config\['smtp_host'\] = ''#\$config['smtp_host'] = '$SMTP_HOST'#g" $PROJECT_DIR/application/config/email.php
|
||||||
|
@ -16,31 +16,22 @@ createAppSettings() {
|
||||||
sed -i "s#// \$config\['smtp_port'\] = 25#\$config['smtp_port'] = $SMTP_PORT#g" $PROJECT_DIR/application/config/email.php
|
sed -i "s#// \$config\['smtp_port'\] = 25#\$config['smtp_port'] = $SMTP_PORT#g" $PROJECT_DIR/application/config/email.php
|
||||||
fi
|
fi
|
||||||
sed -i "s/url-to-easyappointments-directory/$APP_URL/g" $PROJECT_DIR/config.php
|
sed -i "s/url-to-easyappointments-directory/$APP_URL/g" $PROJECT_DIR/config.php
|
||||||
}
|
|
||||||
|
|
||||||
updateApacheSettings() {
|
chown -R www-data $PROJECT_DIR
|
||||||
sed -i "s#^DocumentRoot \".*#DocumentRoot \"$PROJECT_DIR\"#g" /etc/apache2/httpd.conf
|
|
||||||
sed -i "s#/var/www/localhost/htdocs#$PROJECT_DIR#" /etc/apache2/httpd.conf
|
|
||||||
printf "\n<Directory \"$PROJECT_DIR\">\n\tAllowOverride All\n</Directory>\n" >> /etc/apache2/httpd.conf
|
|
||||||
|
|
||||||
chown -R apache:apache $PROJECT_DIR
|
|
||||||
chmod -R 777 $PROJECT_DIR/storage/uploads
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" == "run" ]; then
|
if [ "$1" = "run" ]; then
|
||||||
|
|
||||||
echo "Preparing Easy!Appointments production configuration.."
|
echo "Preparing Easy!Appointments production configuration.."
|
||||||
|
|
||||||
createAppSettings
|
createAppSettings
|
||||||
|
|
||||||
updateApacheSettings
|
echo "Starting Easy!Appointments production server.."
|
||||||
|
|
||||||
echo "Starting Easy!Appointments development server.."
|
exec docker-php-entrypoint apache2-foreground
|
||||||
|
|
||||||
exec httpd -D FOREGROUND
|
elif [ "$1" = "dev" ]; then
|
||||||
|
|
||||||
elif [ "$1" == "dev" ]; then
|
|
||||||
|
|
||||||
echo "Preparing Easy!Appointments development configuration.."
|
echo "Preparing Easy!Appointments development configuration.."
|
||||||
|
|
||||||
|
@ -48,11 +39,9 @@ elif [ "$1" == "dev" ]; then
|
||||||
createAppSettings
|
createAppSettings
|
||||||
sed -i "s/DEBUG_MODE = FALSE/DEBUG_MODE = TRUE/g" $PROJECT_DIR/config.php
|
sed -i "s/DEBUG_MODE = FALSE/DEBUG_MODE = TRUE/g" $PROJECT_DIR/config.php
|
||||||
|
|
||||||
updateApacheSettings
|
|
||||||
|
|
||||||
echo "Starting Easy!Appointments production server.."
|
echo "Starting Easy!Appointments production server.."
|
||||||
|
|
||||||
exec httpd -D FOREGROUND
|
exec docker-php-entrypoint apache2-foreground
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec $@
|
exec $@
|
||||||
|
|
Loading…
Reference in a new issue