Skip to content

Commit aee1b8e

Browse files
authored
Merge pull request #236 from ComputerScienceHouse/docker_multistage
Splitting into multistage
2 parents 728819f + 902f73e commit aee1b8e

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Dockerfile
2+
.dockerignore
3+
.gitignore
4+
.nvmrc
5+
node_modules
6+
assets/dist
7+
assets/prod
8+
LICENSE
9+
README.md
10+

Dockerfile

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
FROM php:7.1-apache
1+
FROM node:10-buster-slim as builder
2+
LABEL author="Devin Matte <[email protected]>"
3+
4+
WORKDIR /usr/src/schedule
5+
COPY package.json ./
6+
7+
RUN npm install
8+
9+
COPY package.json tsconfig.json gulpfile.js ./
10+
COPY assets ./assets
11+
RUN npm run-script build
12+
13+
14+
FROM php:7.3-apache as php-setup
215
LABEL author="Devin Matte <[email protected]>"
316

417
RUN echo "deb-src http://deb.debian.org/debian buster main" >> /etc/apt/sources.list
@@ -21,6 +34,7 @@ RUN apt-get -yq update && \
2134
libjpeg-dev \
2235
libfreetype6-dev \
2336
libxml2-dev \
37+
unzip \
2438
wget \
2539
--no-install-recommends
2640

@@ -40,22 +54,18 @@ RUN docker-php-ext-install mysqli && \
4054

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

57+
58+
FROM php-setup
59+
LABEL author="Devin Matte <[email protected]>"
60+
4361
COPY apache-config.conf /etc/apache2/sites-enabled/000-default.conf
4462

4563
RUN a2enmod rewrite && a2enmod headers && a2enmod expires && \
4664
sed -i '/Listen/{s/\([0-9]\+\)/8080/; :a;n; ba}' /etc/apache2/ports.conf && \
4765
chmod og+rwx /var/lock/apache2 && chmod -R og+rwx /var/run/apache2
4866

4967
COPY . /var/www/html
50-
51-
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
52-
&& apt-get -yq update \
53-
&& apt-get -yq install nodejs --no-install-recommends \
54-
&& npm install \
55-
&& npm run-script build \
56-
&& apt-get -yq remove nodejs \
57-
&& apt-get -yq clean all \
58-
&& rm -rf node_modules
68+
COPY --from=builder /usr/src/schedule/assets/prod /var/www/html/assets/prod
5969

6070
RUN composer install
6171

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"include": [
3-
"assets/src/modules/sm/**/*.ts"
3+
"./assets/src/modules/sm/**/*.ts"
44
],
5-
"exclude": ["node_modules"],
5+
"exclude": ["./node_modules"],
66
"compilerOptions": {
77
"module": "es2015",
88
"allowJs": false,

0 commit comments

Comments
 (0)