Merge pull request #534 from marner2/feature/add_dockerfiles

Add Docker dev support
This commit is contained in:
Matthew Ross 2020-07-16 10:10:01 -04:00 committed by GitHub
commit 4f77e89d4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 99 additions and 1 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
.git
.cache
.github
.vscode
node_modules
Dockerfile
docker-compose.yml

22
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
// 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": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"log": true,
"externalConsole": false,
"pathMappings": {
"/var/www/html/api": "${workspaceRoot}/src/api",
},
"ignore": [
"**/vendor/**/*.php"
]
}
]
}

49
Dockerfile Normal file
View File

@ -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
# ------------------------
# 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

9
docker-compose.yml Normal file
View File

@ -0,0 +1,9 @@
version: "3"
services:
taskboard:
image: "taskboard"
build:
context: .
ports:
- "8081:80"

View File

@ -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"
}
}

11
xdebug.ini Normal file
View File

@ -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