diff --git a/plone-5/.dockerignore b/plone-5/.dockerignore index 8a7040d8..6d33cbc8 100644 --- a/plone-5/.dockerignore +++ b/plone-5/.dockerignore @@ -1,7 +1,9 @@ * !zope.conf !instance/custom.cfg +!instance/develop.cfg !instance/src +!instance/bin !build-and-start.sh !instance/site.cfg instance/src/ukstats.ccv2.theme \ No newline at end of file diff --git a/plone-5/Dockerfile.tests b/plone-5/Dockerfile.tests new file mode 100644 index 00000000..1a706811 --- /dev/null +++ b/plone-5/Dockerfile.tests @@ -0,0 +1,12 @@ +FROM plone:5.2.7-python38 + +COPY instance/develop.cfg /plone/instance/ +COPY instance/src /plone/instance/src/ +RUN \ + sed -i '/mysqlclient\|cx-Oracle\|ldap/d' buildout.cfg && \ + buildout -c develop.cfg && \ + find /data -not -user plone -exec chown plone:plone {} \+ && \ + find /plone -not -user plone -exec chown plone:plone {} \+ + +WORKDIR /plone/instance +CMD ["./bin/test"] \ No newline at end of file diff --git a/plone-5/Makefile b/plone-5/Makefile index 3ff6614d..44497236 100644 --- a/plone-5/Makefile +++ b/plone-5/Makefile @@ -7,6 +7,11 @@ all: build build: docker build --build-arg POSTGRES_PASSWORD=$(POSTGRES_PASSWORD) --tag plone . +.PHONY: test +test: + docker build -t test-plone -f Dockerfile.tests . + docker run -it test-plone + .PHONY: debug debug: build docker run -p 8080:8080 plone \ No newline at end of file diff --git a/plone-5/bootstrap.sh b/plone-5/bootstrap.sh index 18ad1b9e..720415f4 100755 --- a/plone-5/bootstrap.sh +++ b/plone-5/bootstrap.sh @@ -18,7 +18,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then # and it doesn't find it without these env vars... ZLIB_BASE=$(brew --prefix zlib) export LDFLAGS="-L${ZLIB_BASE}/lib" - export CPPFLAGS="-I${ZLIB_BASE}/include" + export CPPFLAGS="-I${ZLIB_BASE}/include -Wno-error=implicit-function-declaration" else sed -i 's|var-dir=/data|var-dir=data|;/RelStorage\|psycopg2\|mysqlclient\|cx-Oracle\|ldap/d' instance/buildout.cfg fi @@ -35,7 +35,12 @@ export $(docker inspect --format='{{join .Config.Env " "}}' plone:${PLONE_VERSIO # restore my path variable export PATH=$mypath -pipenv install requests pip==$PIP setuptools==$SETUPTOOLS zc.buildout==$ZC_BUILDOUT wheel==$WHEEL +sudo pipenv install requests pip==$PIP setuptools==$SETUPTOOLS zc.buildout==$ZC_BUILDOUT wheel==$WHEEL cd instance -pipenv run buildout -c custom.cfg + +if [[ -z "$1" ]]; then + sudo pipenv run buildout -c custom.cfg +else + sudo pipenv run buildout -c $1 +fi cd .. diff --git a/plone-5/plone.md b/plone-5/plone.md index 97fc9ebf..de4206cf 100644 --- a/plone-5/plone.md +++ b/plone-5/plone.md @@ -33,7 +33,7 @@ brew install pipenv zlib libjpeg # zlib ZLIB_BASE=$(brew --prefix zlib) export LDFLAGS="-L${ZLIB_BASE}/lib" -export CPPFLAGS="-I${ZLIB_BASE}/include" +export CPPFLAGS="-I${ZLIB_BASE}/include -Wno-error=implicit-function-declaration" ``` ## 2. Bootstrap @@ -41,6 +41,8 @@ Docker is used to extract a baseline `buildout` config. Plone can be run in a Pi Finally, run `./bootstrap.sh` to create a local, virtualenv (Pipenv) separate environment with all the right dependencies fetched by `buildout` and placed into the `buildout-cache` directory. +Optionally, running `./bootstrap.sh ` with the name of another .cfg file will force the buildout stage to use that configuration. It uses `custom.cfg` by default, but `./bootstrap.sh develop.cfg` may be necessary to generate test scripts. + ## 3. Launch Once buildout completes, the `instance` directory will contain all necessary dependencies and scripts used to launch Plone. This can be launched directly: diff --git a/volto/Makefile b/volto/Makefile index adacf2c7..8d89c00e 100644 --- a/volto/Makefile +++ b/volto/Makefile @@ -3,21 +3,27 @@ SHELL=bash RAZZLE_PATH=http://localhost:8080/climate-change .PHONY: all -all: test build +all: audit test build .PHONY: build build: yarn build .PHONY: install -build: +install: yarn develop && yarn install +# yarn audit will always return a non-zero exit code if +# any vulnerabilities are found regardless of severity +.PHONY: audit +audit: install + yarn audit --summary + .PHONY: test -test: - yarn test +test: install + yarn test --watchAll=false .PHONY: debug debug: yarn run clean - RAZZLE_DEV_PROXY_API_PATH=$(RAZZLE_PATH) yarn start:dev \ No newline at end of file + RAZZLE_DEV_PROXY_API_PATH=$(RAZZLE_PATH) yarn start:dev