diff --git a/.dockerignore b/.dockerignore index fa4a97e4..940d1266 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,6 +8,7 @@ !.yarnrc.yml !.yarn/plugins !.yarn/releases +!.yarn/patches **/node_modules/ **/site/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39562b48..5dc0380b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - node: [ '12', '14' ] + node: [ '16', '18' ] steps: - name: Checkout code uses: actions/checkout@v2 @@ -29,7 +29,7 @@ jobs: echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" | sudo tee /etc/apt/preferences.d/99nginx sudo apt-get update -y - sudo apt-get install -y nginx=1.18.0-2~focal nginx-module-njs=1.18.0.0.4.4-2~focal + sudo apt-get install -y nginx=1.24.0-1~focal nginx-module-njs=1.24.0+0.8.1-1~focal - name: Show NJS versions for debugging run: sudo apt-cache showpkg nginx-module-njs - name: Set up node/yarn diff --git a/Dockerfile b/Dockerfile index 5b51994d..ef276f66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,13 @@ RUN npm install -g yarn COPY package.json yarn.lock ./ COPY .yarnrc.yml ./ ADD packages/ packages/ +ADD docker/ docker/ ADD .yarn/plugins .yarn/plugins ADD .yarn/releases .yarn/releases +ADD .yarn/patches .yarn/patches RUN yarn install -RUN yarn build:online +RUN yarn build # Build stage to extract envsubst FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8 as envsubst @@ -69,9 +71,10 @@ RUN mkdir -p /usr/share/nginx/html/online/osconsole && \ chown 998 /usr/share/nginx/html/online/osconsole/config.json && \ chmod g=u /usr/share/nginx/html/online/osconsole/config.json -COPY docker/nginx.js docker/rbac.js docker/js-yaml.js docker/jwt-decode.js /etc/nginx/conf.d/ +## Copies these to / then nginx.sh will link to them on running of the container COPY docker/nginx.conf docker/nginx-gateway.conf.template docker/nginx-gateway-k8s.conf.template docker/osconsole/config.sh docker/nginx.sh docker/ACL.yaml / +COPY --from=builder /hawtio-online/docker/dist/nginx.js /etc/nginx/conf.d/ COPY --from=builder /hawtio-online/packages/online-shell/build /usr/share/nginx/html/online/ COPY --from=envsubst /usr/bin/envsubst /usr/local/bin/ diff --git a/package.json b/package.json index 7574825d..8b48b0b5 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "docker" ], "scripts": { - "build": "yarn build:online", + "build": "yarn build:online && yarn build:docker", + "build:docker": "yarn workspace @hawtio/online-docker build", "start:online": "yarn build:mgmt && yarn start:shell", "build:online": "yarn build:mgmt && yarn build:shell", "start:shell": "yarn workspace @hawtio/online-shell start", @@ -38,8 +39,9 @@ "license": "license-reporter merge --mpn='hawtio-online' --mlx='./packages/online/licenses/licenses.xml,./packages/integration/licenses/licenses.xml' --mo=licenses.xml -o=docker/licenses", "gen:proxying": "./scripts/generate-proxying.sh", "gen:serving": "./scripts/generate-serving.sh", - "test:docker": "jasmine docker/*.spec.js", - "test:nginx": "cd docker/ && HAWTIO_ONLINE_RBAC_ACL= njs test.js", + "test": "yarn test:docker && yarn test:nginx", + "test:docker": "yarn workspace @hawtio/online-docker test", + "test:nginx": "yarn workspace @hawtio/online-docker njs:test", "deploy:k8s:namespace": "kubectl apply --kustomize deploy/k8s/namespace/", "deploy:k8s:cluster": "kubectl apply --kustomize deploy/k8s/cluster/", "deploy:openshift:namespace": "oc apply --kustomize deploy/openshift/namespace/",