diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9ce7716 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +Dockerfile +.dockerignore +.gitignore +.nvmrc +node_modules +assets/dist +assets/prod +LICENSE +README.md + diff --git a/Dockerfile b/Dockerfile index 3c1cb07..2a3b423 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,17 @@ -FROM php:7.1-apache +FROM node:10-buster-slim as builder +LABEL author="Devin Matte " + +WORKDIR /usr/src/schedule +COPY package.json ./ + +RUN npm install + +COPY package.json tsconfig.json gulpfile.js ./ +COPY assets ./assets +RUN npm run-script build + + +FROM php:7.3-apache as php-setup LABEL author="Devin Matte " RUN echo "deb-src http://deb.debian.org/debian buster main" >> /etc/apt/sources.list @@ -21,6 +34,7 @@ RUN apt-get -yq update && \ libjpeg-dev \ libfreetype6-dev \ libxml2-dev \ + unzip \ wget \ --no-install-recommends @@ -40,6 +54,10 @@ RUN docker-php-ext-install mysqli && \ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +FROM php-setup +LABEL author="Devin Matte " + COPY apache-config.conf /etc/apache2/sites-enabled/000-default.conf RUN a2enmod rewrite && a2enmod headers && a2enmod expires && \ @@ -47,15 +65,7 @@ RUN a2enmod rewrite && a2enmod headers && a2enmod expires && \ chmod og+rwx /var/lock/apache2 && chmod -R og+rwx /var/run/apache2 COPY . /var/www/html - -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ - && apt-get -yq update \ - && apt-get -yq install nodejs --no-install-recommends \ - && npm install \ - && npm run-script build \ - && apt-get -yq remove nodejs \ - && apt-get -yq clean all \ - && rm -rf node_modules +COPY --from=builder /usr/src/schedule/assets/prod /var/www/html/assets/prod RUN composer install diff --git a/tsconfig.json b/tsconfig.json index 1965fe0..bd57958 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "include": [ - "assets/src/modules/sm/**/*.ts" + "./assets/src/modules/sm/**/*.ts" ], - "exclude": ["node_modules"], + "exclude": ["./node_modules"], "compilerOptions": { "module": "es2015", "allowJs": false,