ci: copy theme assets from Docker container

This commit is contained in:
Oliver Davies 2021-12-14 23:28:32 +00:00
parent c898f4da4f
commit 8953de7dbd
5 changed files with 47 additions and 21 deletions

View file

@ -1,4 +1,6 @@
---
- include: ../includes/build-theme-assets.yml
- name: Install Composer dependencies
composer:
command: install
@ -34,5 +36,3 @@
chdir={{ release_web_path }}
register: config_import_result
changed_when: "'There are no changes to import' not in config_import_result.stderr"
- include: ../includes/build-theme-assets.yml

View file

@ -1,19 +1,8 @@
---
- name: Install theme dependencies
command: >
npm ci
chdir={{ release_theme_path }}
creates={{ release_theme_path }}/node_modules
- name: Generate front-end assets
command: >
npm run production
chdir={{ release_theme_path }}
creates={{ release_theme_path }}/dist
- name: Remove files that are no longer needed
file:
path: "{{ release_theme_path }}/{{ item }}"
state: absent
with_items:
- node_modules
- name: Copy theme dependencies from the Docker container.
command: |
pwd
ls
docker-compose pull
./run copy-theme-assets
creates={{ release_theme_path }}/build

View file

@ -55,3 +55,23 @@ 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 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