Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #578

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Dev #578

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 59 additions & 49 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,59 @@
# -------------------
# 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
# -------------------
# Build Stage 1 (npm)
# -------------------
FROM node:alpine AS appbuild

RUN apk add --update --no-cache \
p7zip \
python2 \
build-base \
curl \
php7 \
php7-json \
php7-phar \
php7-iconv \
php7-openssl \
php7-dom \
php7-mbstring \
php7-xml \
php7-xmlwriter \
php7-ctype \
php7-tokenizer

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

WORKDIR /usr/src/app

COPY ./package.json ./

COPY . ./

RUN npm install

RUN npm run build:prod
# RUN npm run build

# --------------------------
# Build Stage 2 (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 chown 33:33 ./api && chown 33:33 ./api/db && \
mkdir ./api/logs && chown 33:33 ./api/logs

EXPOSE 80

VOLUME $PROJECT/api/db
23 changes: 14 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
version: "3"

services:
taskboard:
image: "taskboard"
build:
context: .
ports:
- "8081:80"
version: "3"

services:
taskboard:
image: "taskboard"
build:
context: .
ports:
- "80:80"
volumes:
- database:/var/www/html/api/db

volumes:
database:
2 changes: 1 addition & 1 deletion src/api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

require './vendor/autoload.php';

R::setup('sqlite:taskboard.sqlite');
R::setup('sqlite:db/taskboard.sqlite');

$container = new DI\Container();
AppFactory::setContainer($container);
Expand Down