Add Dockerfile

This commit is contained in:
Joshua Marner 2020-07-14 15:43:17 -05:00
parent 0b28e3dd81
commit 18b9ba541e
2 changed files with 56 additions and 0 deletions

7
.dockerignore Normal file
View File

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

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