Refactor the production Docker image

This commit is contained in:
Oliver Davies 2021-07-03 23:00:45 +01:00
parent 54507c2d74
commit 1e66df30a1
6 changed files with 27 additions and 33 deletions

View file

@ -2,28 +2,7 @@ version: '2.4'
services:
web:
build:
context: .
dockerfile: tools/docker/images/nginx/Dockerfile
volumes:
- html:/app
image: oliverdavies-uk-web
ports:
- 80:80
depends_on:
- app
- assets
restart: always
app:
volumes:
- assets:/app/source/build
- html:/app/output_prod
- .:/app
command: generate -e prod
assets:
entrypoint: npm
command: run production
volumes:
html:

View file

@ -2,7 +2,10 @@ version: '2.4'
services:
app:
image: opdavies/sculpin-serve
build:
context: .
dockerfile: tools/docker/images/Dockerfile
target: app
volumes:
- assets:/app/source/build
- /app/output_dev
@ -11,9 +14,7 @@ services:
- 8000:8000
assets:
build:
context: .
dockerfile: tools/docker/images/node/Dockerfile
image: node:14
volumes:
- assets:/node/source/build
- /node/node_modules

View file

@ -0,0 +1,21 @@
FROM opdavies/sculpin-serve AS app
WORKDIR /app
COPY composer.* ./
RUN composer install
COPY app app
COPY source source
RUN sculpin generate -e prod
FROM node:14 AS assets
WORKDIR /node
COPY package.json .
COPY package-lock.json .
RUN npm ci
COPY . .
RUN npm run production
FROM nginx AS nginx
COPY tools/docker/images/nginx/root /
WORKDIR /app
COPY --from=app /app/output_prod ./
COPY --from=assets /node/source/build build

View file

@ -1,2 +0,0 @@
FROM nginx:1 as base
COPY tools/docker/images/nginx/root /

View file

@ -603,4 +603,3 @@ server {
rewrite ^/wp-tailwind-static$ https://wp-tailwind.oliverdavies.uk;
rewrite ^/yXhoS$ /talks/things-you-should-know-about-php;
}

View file

@ -1,4 +0,0 @@
FROM node:14 AS base
WORKDIR /node
COPY package*.json ./
RUN npm install