# HG changeset patch # User RhodeCode Admin # Date 2023-12-19 08:04:49 # Node ID 49f00b60284661b8c28b742089ca87e0d57baf1c # Parent 8b86360e7d05ab9a66908122a9fcef3b32d1bc4b dev(static-files): new way of building static files diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -5,10 +5,6 @@ SHELL = /bin/bash # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES} -NODE_PATH=./node_modules -WEBPACK=./node_binaries/webpack -GRUNT=./node_binaries/grunt - .PHONY: clean ## Cleanup compiled and cache py files clean: @@ -86,22 +82,12 @@ docs-cleanup: .PHONY: web-build ## Build JS packages static/js -# https://hub.docker.com/r/huli/grunt web-build: - NODE_PATH=$(NODE_PATH) $(GRUNT) + docker run -it --rm -v $(PWD):/project --workdir=/project rhodecode/static-files-build:16 -c "npm install && grunt" + # run static file check + ./rhodecode/tests/scripts/static-file-check.sh rhodecode/public/ + rm -rf node_modules - # check required files - STATIC_CHECK="/robots.txt /502.html \ - /js/scripts.min.js /js/rhodecode-components.js \ - /css/style.css /css/style-polymer.css /css/style-ipython.css" - - for file in $STATIC_CHECK; - do - if [ ! -f rhodecode/public/$file ]; then - echo "Missing $file expected after web-build" - exit 1 - fi - done .PHONY: pip-packages ## Show outdated packages diff --git a/static-build.dockerfile b/static-build.dockerfile new file mode 100644 --- /dev/null +++ b/static-build.dockerfile @@ -0,0 +1,39 @@ +## HOW TO: ## +## +## build this image add --no-cache for forced-build: + +## ** BUILD ** +# docker build --tag rhodecode/static-files-build:16 -f static-build.dockerfile . +# docker build --tag rhodecode/static-files-build:18 -f static-build.dockerfile . + +## run grunt on top of the source code +## cd rhodecode-enterprise-ce +## docker run --rm -v $PWD:/project --workdir=/project rhodecode/static-files-build grunt + +## ** GENERATE ** +## docker run -it --entrypoint bash --rm -v $PWD:/project --workdir=/project rhodecode/static-files-build:16 -c "npm install && grunt -v" + +# THIS WORKS NOW +FROM node:16-buster +#FROM node:18-buster + +WORKDIR /static_build + +RUN apt-get update \ + && apt-get install --no-install-recommends --yes \ + curl \ + zip \ + && apt-get autoremove \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# make node scripts visible +ENV \ + PATH=/static_build/node_modules/.bin:/project/node_modules/.bin:$PATH \ + NODE_PATH=/node_modules/.bin/node_mod \ + WEBPACK=/static_build/node_modules/.bin/webpack \ + GRUNT=/static_build/node_modules/.bin/grunt + +WORKDIR /project + +ENTRYPOINT ["bash"]