From 18b9ba541e7e09c2bbd3285d6ea90262946424b1 Mon Sep 17 00:00:00 2001 From: Joshua Marner Date: Tue, 14 Jul 2020 15:43:17 -0500 Subject: [PATCH 1/4] Add Dockerfile --- .dockerignore | 7 +++++++ Dockerfile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2335c7a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.git +.cache +.github +.vscode +node_modules +Dockerfile +docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1c63e1f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,49 @@ +# ------------------- +# Build Stage 1 (npm) +# ------------------- +FROM node:alpine AS appbuild + +RUN apk add --update --no-cache p7zip + +WORKDIR /usr/src/app + +COPY ./package.json ./ +RUN npm install + +COPY . ./ +RUN npm run build:prod +# RUN npm run build:dev + + +# ------------------------ +# Build Stage 2 (composer) +# ------------------------ +FROM composer AS apibuild + +WORKDIR /app + +COPY ./src/api ./ +RUN composer install + + +# -------------------------- +# Build Stage 3 (php-apache) +# This build takes the production build from staging builds +# -------------------------- +FROM php:7.3-apache + +ENV PROJECT /var/www/html + +RUN apt-get update && apt-get install -y sqlite3 php7.3-sqlite +RUN a2enmod rewrite expires +# RUN docker-php-ext-install pdo_mysql + +# RUN pecl install xdebug && docker-php-ext-enable xdebug +# COPY xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini + +WORKDIR $PROJECT +COPY --from=appbuild /usr/src/app/dist ./ +RUN rm -rf ./api/* +COPY --from=apibuild /app ./api/ +RUN chmod 777 ./api +EXPOSE 80 From 2a8aa69bbee45325dcb8cc2d0c6f0d4e494d68e2 Mon Sep 17 00:00:00 2001 From: Joshua Marner Date: Tue, 14 Jul 2020 15:43:34 -0500 Subject: [PATCH 2/4] Fix dependency issue with angular and typescript --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a115915..83a0c9d 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,6 @@ "ts-node": "^8.10.2", "tslib": "^1.13.0", "tslint": "^6.1.2", - "typescript": "^3.8.3" + "typescript": "~3.8.3" } } From a8fadad03ef97fbacb010041948a86c78b38aa9b Mon Sep 17 00:00:00 2001 From: Joshua Marner Date: Tue, 14 Jul 2020 15:45:05 -0500 Subject: [PATCH 3/4] Add ability to debug with vscode and docker --- .vscode/launch.json | 29 +++++++++++++++++++++++++++++ docker-compose.yml | 9 +++++++++ xdebug.ini | 11 +++++++++++ 3 files changed, 49 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 docker-compose.yml create mode 100644 xdebug.ini diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7de9e89 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Chrome", + "request": "launch", + "type": "pwa-chrome", + "url": "http://localhost:8081", + "webRoot": "${workspaceFolder}/src" + }, + { + "name": "Listen for XDebug", + "type": "php", + "request": "launch", + "port": 9000, + "log": true, + "externalConsole": false, + "pathMappings": { + "/var/www/html/api": "${workspaceRoot}/src/api", + }, + "ignore": [ + "**/vendor/**/*.php" + ] + } + ] +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..cca2b66 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: "3" + +services: + taskboard: + image: "taskboard" + build: + context: . + ports: + - "8081:80" diff --git a/xdebug.ini b/xdebug.ini new file mode 100644 index 0000000..2137aeb --- /dev/null +++ b/xdebug.ini @@ -0,0 +1,11 @@ +[xdebug] +zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so +xdebug.default_enable=1 +xdebug.remote_enable=1 +xdebug.remote_port=9000 +xdebug.remote_handler=dbgp +xdebug.remote_connect_back=0 +xdebug.remote_host=host.docker.internal +xdebug.idekey=VSCODE +xdebug.remote_autostart=1 +xdebug.remote_log=/usr/local/etc/php/xdebug.log From a3602b436d897d73d5cd0e82d9b8d48f6e73f43d Mon Sep 17 00:00:00 2001 From: Joshua Marner Date: Tue, 14 Jul 2020 16:04:44 -0500 Subject: [PATCH 4/4] Small fixes --- .vscode/launch.json | 9 +-------- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7de9e89..796de01 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,13 +4,6 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "name": "Launch Chrome", - "request": "launch", - "type": "pwa-chrome", - "url": "http://localhost:8081", - "webRoot": "${workspaceFolder}/src" - }, { "name": "Listen for XDebug", "type": "php", @@ -26,4 +19,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/Dockerfile b/Dockerfile index 1c63e1f..83ee8aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN npm install COPY . ./ RUN npm run build:prod -# RUN npm run build:dev +# RUN npm run build # ------------------------