build(docker): remove duplicate assets service

This commit is contained in:
Oliver Davies 2021-12-28 01:42:45 +00:00
parent 90d593fef8
commit 84963c8a31
2 changed files with 3 additions and 43 deletions

View file

@ -1,9 +1,10 @@
FROM node:14-alpine AS assets-build
FROM node:14-alpine AS assets
WORKDIR /app
RUN mkdir /node_modules \
chown node:node -R /node_modules /app
USER node
WORKDIR /app/web/themes/custom/opdavies
COPY web/themes/custom/opdavies/.yarnrc .
COPY web/themes/custom/opdavies/package.json .
COPY web/themes/custom/opdavies/yarn.lock .
RUN yarn install && yarn cache clear
@ -17,7 +18,7 @@ COPY tools/docker/images/nginx/configs/vhost.conf /etc/nginx/conf.d/default.conf
WORKDIR /app
COPY web web/
WORKDIR /app/web/themes/custom/opdavies
COPY --from=assets-build /app/web/themes/custom/opdavies/build build
COPY --from=assets /app/web/themes/custom/opdavies/build build
###
@ -61,24 +62,3 @@ COPY composer.json composer.lock /app/
COPY assets /app/assets
COPY tools/patches /app/tools/patches
RUN composer install
###
FROM node:14-alpine AS assets
WORKDIR /node
COPY web/themes/custom/opdavies/package*.json ./
RUN npm install
COPY config config
COPY web/themes/custom/opdavies/postcss.config.js .
COPY web/themes/custom/opdavies/webpack.config.js .
COPY web/themes/custom/opdavies/tailwind.config.js .
COPY web/themes/custom/opdavies/tailwindcss tailwindcss
COPY web/themes/custom/opdavies/assets assets
COPY web/themes/custom/opdavies/templates templates
RUN npm run prod \
&& rm -fr node_modules

View file

@ -46,23 +46,3 @@ services:
test: ["CMD-SHELL", "bash", "-c", "echo > /dev/tcp/localhost/3306"]
interval: 1s
restart: unless-stopped
node:
build:
context: .
target: assets
image: ghcr.io/opdavies/oliverdavies-uk-assets:node-14
working_dir: /node
entrypoint: sh
volumes:
- assets:/node/build
- node_modules:/node/node_modules
- ./config:/node/config
- ./web/themes/custom/opdavies/assets:/node/assets
- ./web/themes/custom/opdavies/package.json:/node/package.json
- ./web/themes/custom/opdavies/yarn.lock:/node/yarn.lock
- ./web/themes/custom/opdavies/postcss.config.js:/node/postcss.config.js
- ./web/themes/custom/opdavies/tailwindcss:/node/tailwindcss
- ./web/themes/custom/opdavies/tailwind.config.js:/node/tailwind.config.js
- ./web/themes/custom/opdavies/templates:/node/templates
- ./web/themes/custom/opdavies/webpack.config.js:/node/webpack.config.js