From 1cc4eb5ccdd32dfca824bc1cede5ef963b5bcb90 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sun, 2 Nov 2025 11:27:31 -0300 Subject: [PATCH] fix: fixes broken build --- .github/workflows/deploy.yml | 5 +-- .k8s/deployment.yaml | 17 +++------- Dockerfile | 21 ++++++------ package-lock.json | 64 ++++++++++++++++++++++++++++++++++++ package.json | 3 +- set_env.js | 2 +- 6 files changed, 82 insertions(+), 30 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ef0ea18..838ccc2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -110,10 +110,7 @@ jobs: REPO=$(echo "${GITHUB_REPOSITORY#*/}" | tr '[:upper:]' '[:lower:]') IMAGE_BASE="ghcr.io/${OWNER}/${REPO}" - TAG="${{ github.event.inputs.tag || 'latest' }}" - - echo "Deploying image: ${IMAGE_BASE}:${TAG} to Kubernetes Namespace: ${KUBE_NAMESPACE}" - kubectl config use-context --current --namespace=${KUBE_NAMESPACE} + IMAGE_TAG="${{ github.event.inputs.tag || 'latest' }}" # Apply any other configuration changes if needed envsubst < .k8s/config.yml | kubectl apply -f - diff --git a/.k8s/deployment.yaml b/.k8s/deployment.yaml index 115f7e3..da080b9 100644 --- a/.k8s/deployment.yaml +++ b/.k8s/deployment.yaml @@ -16,21 +16,12 @@ spec: app: frontend spec: nodeSelector: - ${WORKER_NODE_LABEL} - initContainers: - - name: wait-backend-init - image: busybox:latest - args: - - /bin/sh - - -c - - > - set -x; - while [ $(curl -sw '%{http_code}' "backend-service:8000/health" -o /dev/null) -ne 200 ]; do - sleep 15; - done + $WORKER_NODE_LABEL + imagePullSecrets: + - name: ghcr-login-secret containers: - name: frontend - image: ${IMAGE_BASE}:${TAG} + image: ${IMAGE_BASE}:${IMAGE_TAG} imagePullPolicy: "Always" resources: requests: diff --git a/Dockerfile b/Dockerfile index 3e85132..f542ec8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,27 +4,26 @@ FROM base AS build WORKDIR /app -COPY package*.json ./ +RUN npm install -g @angular/cli@20.3.8 -RUN npm install +COPY package*.json ./ +RUN npm install --production + +COPY . . +RUN npm run build:prod FROM base AS prod WORKDIR /app -RUN apk add --update gettext python3 py3-pip py3-setuptools make g++ && \ - rm -rf /var/cache/apk/* - - COPY --from=build /app/node_modules ./node_modules -COPY . . +COPY --from=build /app/dist ./dist +COPY --from=build /app/server.js ./ +COPY --from=build /app/set_env.js ./ +COPY --from=build /app/package*.json ./ -RUN npm install -g @angular/cli@20.3.8 - -RUN npm run build:prod - EXPOSE 5000-7000 CMD ["npm", "run", "start:prod"] diff --git a/package-lock.json b/package-lock.json index 4cc07f3..c85e250 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "@sinclair/typebox": "^0.32.4", "apexcharts": "^3.45.1", "bootstrap": "^4.6.2", + "compression": "^1.8.1", "cookieconsent": "^3.1.1", "cors": "^2.8.5", "dotenv": "^17.2.3", @@ -6741,6 +6742,60 @@ "node": ">=4.0.0" } }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "license": "MIT", + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.8.1.tgz", + "integrity": "sha512-9mAqGPHLakhCLeNyxPkK4xVo746zQ/czLH1Ky+vkitMnWfWZps8r0qXuwhwizagCRttsL4lfG4pIOvaWLpAP0w==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "compressible": "~2.0.18", + "debug": "2.6.9", + "negotiator": "~0.6.4", + "on-headers": "~1.1.0", + "safe-buffer": "5.2.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/compression/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/compression/node_modules/negotiator": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", + "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -11287,6 +11342,15 @@ "node": ">= 0.8" } }, + "node_modules/on-headers": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz", + "integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", diff --git a/package.json b/package.json index 6806781..d9d66bc 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "@sinclair/typebox": "^0.32.4", "apexcharts": "^3.45.1", "bootstrap": "^4.6.2", + "compression": "^1.8.1", "cookieconsent": "^3.1.1", "cors": "^2.8.5", "dotenv": "^17.2.3", @@ -78,4 +79,4 @@ "target": "http://localhost:8070" } } -} \ No newline at end of file +} diff --git a/set_env.js b/set_env.js index f1fc67b..3d9db77 100644 --- a/set_env.js +++ b/set_env.js @@ -1,6 +1,6 @@ function getPrefix() { if (process.argv.includes('--prod') || process.argv.includes('-p')) { - return `${__dirname}/dist/frontend-hideyoshi.com` + return `${__dirname}/dist/frontend-hideyoshi.com/browser/` } return `${__dirname}/src` }