From 84963c8a31a2c3310a2c334a249d3bf03d4586c2 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 28 Dec 2021 01:42:45 +0000 Subject: [PATCH] build(docker): remove duplicate assets service --- Dockerfile | 26 +++----------------------- docker-compose.yaml | 20 -------------------- 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3dc08ec..dfa58f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/docker-compose.yaml b/docker-compose.yaml index 9abe691..c5679b2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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