From 1e4d5545ae0642e1a309faec174d9329b0ec206e Mon Sep 17 00:00:00 2001 From: Devin Matte Date: Tue, 1 Sep 2020 17:43:22 -0400 Subject: [PATCH 1/2] Splitting into multistage --- .dockerignore | 10 ++++++++++ Dockerfile | 30 ++++++++++++++++++++---------- tsconfig.json | 4 ++-- 3 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 .dockerignore 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..c19e9c9 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 --silent + +COPY package.json tsconfig.json gulpfile.js ./ +COPY assets ./assets +RUN npm run-script build + + +FROM php:7.1-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, From 902f73ec768e9e696e27616496f1e57c47b50023 Mon Sep 17 00:00:00 2001 From: Devin Matte Date: Sun, 18 Oct 2020 22:13:21 -0400 Subject: [PATCH 2/2] Upgrading to PHP 7.3 --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c19e9c9..2a3b423 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,14 +4,14 @@ LABEL author="Devin Matte " WORKDIR /usr/src/schedule COPY package.json ./ -RUN npm install --silent +RUN npm install COPY package.json tsconfig.json gulpfile.js ./ COPY assets ./assets RUN npm run-script build -FROM php:7.1-apache as php-setup +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 @@ -34,7 +34,7 @@ RUN apt-get -yq update && \ libjpeg-dev \ libfreetype6-dev \ libxml2-dev \ - unzip \ + unzip \ wget \ --no-install-recommends