diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..42f638d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM webdevops/php-nginx:8.3 + +WORKDIR /var/www/html +ENV WEB_DOCUMENT_ROOT /var/www/html/src + +RUN apt-get update \ + && apt-get install -y procps + +EXPOSE 80 + +COPY ./ $WORKDIR \ No newline at end of file diff --git a/Dockerfile-local b/Dockerfile-local new file mode 100644 index 0000000..3c1b2aa --- /dev/null +++ b/Dockerfile-local @@ -0,0 +1,17 @@ +FROM webdevops/php-nginx:8.3 + +ADD config/nginx/default.conf /etc/nginx/conf.d + +WORKDIR /var/www/html +ENV SERVER_ENV local +ENV WEB_DOCUMENT_ROOT /var/www/html + +RUN apt-get update \ + && apt-get install -y procps \ + && pecl install xdebug + +EXPOSE 80 + +COPY ./ $WORKDIR + +CMD ["/bin/sh", "-c", "scripts/app_init_local.sh && supervisord"] \ No newline at end of file diff --git a/config/nginx/default.conf b/config/nginx/default.conf new file mode 100644 index 0000000..443322c --- /dev/null +++ b/config/nginx/default.conf @@ -0,0 +1,20 @@ +server { + listen 80; + server_name checkinrequestservice.local; + root /var/www/html; + + location / { + try_files $uri $uri /index.php?$args; + } + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_read_timeout 300s; + include fastcgi_params; + } +} diff --git a/db/docker-compose-db.yml b/db/docker-compose-db.yml deleted file mode 100644 index 2e663b0..0000000 --- a/db/docker-compose-db.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '2' -services: - checkin-request-service-db: - image: postgres:10.5-alpine - container_name: checkin-service-postgres-db - environment: - - POSTGRES_DB=checkin_requests - - POSTGRES_PASSWORD=localpasswordsimplepassword - ports: - - '25432:5432' - networks: - checkinservice: - volumes: - - ./init-test-db.sql:/docker-entrypoint-initdb.d/init.sql - -networks: - checkinservice: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0f68b6f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +services: + checkin-request-service-web: + build: + context: . + dockerfile: Dockerfile-local + container_name: checkin-request-service-web + ports: + - "8888:80" + networks: + checkinservice: + volumes: + - ./:/var/www/html + checkin-request-service-db: + image: postgres:10.5-alpine + container_name: checkin-service-postgres-db + environment: + - POSTGRES_DB=checkin_requests + - POSTGRES_PASSWORD=localpasswordsimplepassword + ports: + - "25432:5432" + networks: + checkinservice: + volumes: + - ./db/init-test-db.sql:/docker-entrypoint-initdb.d/init.sql + +networks: + checkinservice: diff --git a/scripts/app_init.sh b/scripts/app_init.sh new file mode 100755 index 0000000..25c88b7 --- /dev/null +++ b/scripts/app_init.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "[app_init.sh] Changing dir to $(dirname "$0")." +cd "$(dirname "$0")" + +echo "[app_init.sh] Composer install." +composer install --no-interaction --ignore-platform-reqs --working-dir=.. --no-dev \ No newline at end of file diff --git a/scripts/app_init_local.sh b/scripts/app_init_local.sh new file mode 100755 index 0000000..ab1c11d --- /dev/null +++ b/scripts/app_init_local.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "[app_init_local.sh] Changing dir to $(dirname "$0")." +cd "$(dirname "$0")" + +echo "[app_init_local.sh] Composer install." +composer install --no-interaction --ignore-platform-reqs --working-dir=.. \ No newline at end of file