diff --git a/.ci/quality b/.ci/quality index 8ff2b8a..611d628 100755 --- a/.ci/quality +++ b/.ci/quality @@ -17,7 +17,7 @@ run_shellcheck() run_hadolint() { - docker run --rm --volume "$(pwd):/app" hadolint/hadolint:latest-alpine /bin/sh -c "find '/app/$ANALYSE_PATH' -type f -name '*Dockerfile' ! -path '*/.git/*' ! -path '/app/tmp-test/*' ! -path '/app/test/*' ! -name '*.orig' -print -exec hadolint --ignore DL3003 --ignore DL3008 --ignore DL3016 --ignore DL3018 --ignore SC1091 --ignore DL3002 {} +" + docker run --rm --volume "$(pwd):/app" hadolint/hadolint:latest-alpine /bin/sh -c "find '/app/$ANALYSE_PATH' -type f -name '*Dockerfile' ! -path '*/.git/*' ! -path '/app/tmp-test/*' ! -path '/app/test/*' ! -name '*.orig' -print -exec hadolint --ignore DL3003 --ignore DL3006 --ignore DL3008 --ignore DL3016 --ignore DL3018 --ignore SC1091 --ignore DL3002 {} +" } run_shellcheck diff --git a/.ci/sample-dynamic/workspace.yml b/.ci/sample-dynamic/workspace.yml index 8223e10..3cbeafb 100644 --- a/.ci/sample-dynamic/workspace.yml +++ b/.ci/sample-dynamic/workspace.yml @@ -1,6 +1,6 @@ workspace('ci-node-spa-sample-dynamic'): description: generated local workspace for ci-node-spa-sample. harnessLayers: - - https://github.com/inviqa/harness-docker/archive/refs/tags/0.2.0-alpha2.tar.gz + - https://github.com/inviqa/harness-docker/archive/refs/tags/0.2.0-alpha3.tar.gz attribute('app.build'): dynamic diff --git a/.ci/sample-static/workspace.yml b/.ci/sample-static/workspace.yml index 52a288e..0f1726f 100644 --- a/.ci/sample-static/workspace.yml +++ b/.ci/sample-static/workspace.yml @@ -1,6 +1,6 @@ workspace('ci-node-spa-sample-static'): description: generated local workspace for ci-node-spa-sample. harnessLayers: - - https://github.com/inviqa/harness-docker/archive/refs/tags/0.2.0-alpha2.tar.gz + - https://github.com/inviqa/harness-docker/archive/refs/tags/0.2.0-alpha3.tar.gz attribute('app.build'): static diff --git a/_twig/docker-compose.yml/service/app.yml.twig b/_twig/docker-compose.yml/service/app.yml.twig index 72e8acb..c163c7a 100644 --- a/_twig/docker-compose.yml/service/app.yml.twig +++ b/_twig/docker-compose.yml/service/app.yml.twig @@ -15,7 +15,7 @@ services: stdin_open: true # react-scripts start terminates if stdin closed volumes: - {{ (syncvolume) ? @('workspace.name') ~ '-sync:/app:nocopy' : ('./:/app' ~ @('docker.compose.host_volume_options')) }} - - ./.my127ws/application:/home/node/application + - ./.my127ws/application:{{ @('app.code_owner_home') }}/application - ./.my127ws/docker/image/app/root-node/usr/lib/task:/usr/lib/task - ./.my127ws:/.my127ws {% else %} diff --git a/docker/image/app/Dockerfile.twig b/docker/image/app/Dockerfile.twig index 31bbb30..67759d5 100644 --- a/docker/image/app/Dockerfile.twig +++ b/docker/image/app/Dockerfile.twig @@ -1,31 +1,8 @@ -FROM {{ @('services.app.build.from.node') }} as node -ARG TARGETARCH +{% include 'docker/image/console/Dockerfile.twig' %} +FROM console as node COPY .my127ws/docker/image/app/root-node / -WORKDIR /app - -ENV APP_MODE={{ @('app.mode') }} - -{% if @('app.build') == 'dynamic' %} -USER root - -ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-${TARGETARCH} /sbin/docker-init -RUN chmod +x /sbin/docker-init - -VOLUME /app - -ENTRYPOINT ["/entrypoint.dynamic.sh"] -{% else %} -RUN chown node:node /app -COPY --chown=node:node ./ /app -USER node -RUN app build - -ENTRYPOINT ["/entrypoint.sh"] - -### - FROM {{ @('services.app.build.from.nginx') }} as nginx RUN apk add --no-cache jq @@ -36,4 +13,3 @@ COPY --from=node --chown=root:root {{ @('app.dist_path') }} /usr/share/nginx/htm ENTRYPOINT [ "/docker-entrypoint.sh" ] CMD ["nginx", "-g", "daemon off;"] -{% endif %} diff --git a/docker/image/app/root-node/usr/lib/task/build.sh.twig b/docker/image/app/root-node/usr/lib/task/build.sh.twig deleted file mode 100644 index a46764f..0000000 --- a/docker/image/app/root-node/usr/lib/task/build.sh.twig +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -function task_build() -{ - set -o errexit - set -o nounset - set -o pipefail - - cd /app - - # shellcheck disable=SC2160 - if {{ @('tasks.build.when')|raw }}; then - : - else - return 0; - fi - - {% for step in @('tasks.build.steps') -%} - {{ step|raw }} - {% endfor %} -} diff --git a/docker/image/app/root-node/usr/lib/task/start/dev.sh.twig b/docker/image/app/root-node/usr/lib/task/start/dev.sh.twig index 3016bd1..1e96a72 100644 --- a/docker/image/app/root-node/usr/lib/task/start/dev.sh.twig +++ b/docker/image/app/root-node/usr/lib/task/start/dev.sh.twig @@ -2,7 +2,7 @@ function task_start_dev() { - {% for step in @('tasks.start_dev.steps') -%} + {% for step in @('task.start_dev.steps') -%} {{ step|raw }} {% endfor %} -} \ No newline at end of file +} diff --git a/docker/image/console/root/usr/lib/task/build.sh.twig b/docker/image/console/root/usr/lib/task/build.sh.twig deleted file mode 100644 index 376c996..0000000 --- a/docker/image/console/root/usr/lib/task/build.sh.twig +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -function task_build() -{ - set -o errexit - set -o nounset - set -o pipefail - - if ! [ -f /app/README.md ]; then - task skeleton:apply - fi - - task overlay:apply - - # tasks.build steps removed as build happens in app service. Console only here for ws create and harness upgrades -} diff --git a/harness.yml b/harness.yml index ad8db4f..6bbd151 100644 --- a/harness.yml +++ b/harness.yml @@ -8,7 +8,7 @@ harness('inviqa/node-spa'): confd: - harness:/ parentLayers: - - inviqa/docker:0.2.0-alpha1 + - inviqa/docker:0.2.0-alpha3 --- attributes: app: diff --git a/harness/attributes/common-spa.yml b/harness/attributes/common-spa.yml index c2409f1..b63915c 100644 --- a/harness/attributes/common-spa.yml +++ b/harness/attributes/common-spa.yml @@ -4,7 +4,7 @@ attributes.default: web_directory: /usr/share/nginx/html code_owner: node - tasks: + task: build: when: 'true' steps: @@ -12,7 +12,6 @@ attributes.default: - "= @('app.build') == 'static' ? 'yarn build' : ''" start_dev: steps: - - passthru yarn install - yarn dev nginx: diff --git a/harness/attributes/docker-spa.yml b/harness/attributes/docker-spa.yml index bc7e939..d822907 100644 --- a/harness/attributes/docker-spa.yml +++ b/harness/attributes/docker-spa.yml @@ -12,7 +12,6 @@ attributes.default: resources: memory: 64Mi console: - enabled: = @('app.build') == 'dynamic' build: from: = 'node:' ~ @('node.version') ~ '-slim' publish: false diff --git a/harness/config/confd.yml b/harness/config/confd.yml index 4305a75..391b18f 100644 --- a/harness/config/confd.yml +++ b/harness/config/confd.yml @@ -32,5 +32,4 @@ confd('harness:/'): - { src: docker/image/app/Dockerfile } - { src: docker/image/app/root-nginx/etc/nginx/conf.d/0-nginx.conf } - { src: docker/image/app/root-nginx/etc/nginx/conf.d/default.conf } - - { src: docker/image/app/root-node/usr/lib/task/build.sh } - { src: docker/image/app/root-node/usr/lib/task/start/dev.sh }