From ea286261545d72b1e146724b32ee98a6f7929089 Mon Sep 17 00:00:00 2001 From: stevelr Date: Tue, 14 Dec 2021 18:11:13 -0800 Subject: [PATCH] use shell scripts and avoid Dockerfile completely Signed-off-by: stevelr --- docgen/dev/.gitignore | 3 +++ docgen/dev/Dockerfile | 13 ------------- docgen/dev/build-docker.sh | 3 --- docgen/dev/build-tailwind-css.sh | 7 +++++++ docgen/dev/package.json | 3 +-- docgen/dev/update-css.sh | 23 ++++++++++------------- 6 files changed, 21 insertions(+), 31 deletions(-) create mode 100644 docgen/dev/.gitignore delete mode 100644 docgen/dev/Dockerfile delete mode 100755 docgen/dev/build-docker.sh create mode 100755 docgen/dev/build-tailwind-css.sh diff --git a/docgen/dev/.gitignore b/docgen/dev/.gitignore new file mode 100644 index 0000000..91a3983 --- /dev/null +++ b/docgen/dev/.gitignore @@ -0,0 +1,3 @@ +dist +node_modules +package-lock.json diff --git a/docgen/dev/Dockerfile b/docgen/dev/Dockerfile deleted file mode 100644 index 3f5336c..0000000 --- a/docgen/dev/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:latest - -COPY package.json /project/ - -RUN cd /project \ - && npm install \ - && chown -R node . - -# && npm install tailwindcss@latest autoprefixer@latest \ -# && npx tailwindcss init \ - -WORKDIR /project -USER node diff --git a/docgen/dev/build-docker.sh b/docgen/dev/build-docker.sh deleted file mode 100755 index d5125dd..0000000 --- a/docgen/dev/build-docker.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -docker build -t css-dev . \ No newline at end of file diff --git a/docgen/dev/build-tailwind-css.sh b/docgen/dev/build-tailwind-css.sh new file mode 100755 index 0000000..01d5387 --- /dev/null +++ b/docgen/dev/build-tailwind-css.sh @@ -0,0 +1,7 @@ +#!/bin/sh -x +# This is run inside the docker container created by update-css.sh + +npm install +npm run build +npm run build-prod + diff --git a/docgen/dev/package.json b/docgen/dev/package.json index 4de2080..3e9488e 100644 --- a/docgen/dev/package.json +++ b/docgen/dev/package.json @@ -13,9 +13,8 @@ "tailwindcss": "^2.1.4" }, "scripts": { - "build": "npx tailwindcss-cli@latest build src/css/styles.css -c conf/tailwind.config.js -o dist/tailwind.css", + "build": "npx -y tailwindcss-cli@latest build src/css/styles.css -c conf/tailwind.config.js -o dist/tailwind.css", "build-prod": "NODE_ENV=production npx tailwindcss-cli@latest build src/css/styles.css -c conf/tailwind.config.js -o dist/tailwind.min.css", - "dist": "cp dist/tailwind*.css ../public/css/", "build-all": "npm run build && npm run build-prod && npm run dist", "clean": "rm -rf dist/*.css node_modules/.bin node_modules/*", "test": "echo \"Error: no test specified\" && exit 1" diff --git a/docgen/dev/update-css.sh b/docgen/dev/update-css.sh index 5786570..9dcb377 100755 --- a/docgen/dev/update-css.sh +++ b/docgen/dev/update-css.sh @@ -1,19 +1,16 @@ -#!/bin/sh +#!/bin/sh -ex -OUT=$(mktemp -d) -mkdir $OUT/css -chmod 755 $OUT -chmod 777 $OUT/css - -docker run --rm \ - -v $PWD/../../codegen/templates/html:/templates:ro \ - -v $PWD/conf:/project/conf:ro \ - -v $PWD/src:/project/src:ro \ - -v $OUT:/public \ - css-dev npm run build-all +rm -f dist/*.css +docker run --rm -it \ + -v "$PWD/../../codegen/templates/html:/templates:ro" \ + -v "$PWD:/project:rw" \ + -v "$OUT:/public:rw" \ + --user "$(id -u):$(id -g)" \ + --workdir /project \ + node:latest /project/build-tailwind-css.sh mkdir -p ./gen/css -cp -v $OUT/css/*.css ./gen/css/ +cp -v ./dist/*.css ./gen/css/