diff --git a/components/frontend/Dockerfile b/components/frontend/Dockerfile index c189c75e65..4adb4acf44 100644 --- a/components/frontend/Dockerfile +++ b/components/frontend/Dockerfile @@ -10,20 +10,18 @@ COPY .env /home/frontend RUN npm install --ignore-scripts && \ npm run --ignore-scripts build -FROM node:23.6.1-alpine3.20 +FROM busybox:1.37.0 LABEL maintainer="Quality-time team " LABEL description="Quality-time frontend" WORKDIR /home/frontend -COPY healthcheck.js /home/frontend COPY --from=compile-image /home/frontend/dist /home/frontend/dist -RUN npm install --ignore-scripts -g serve@14.2.4 && \ - adduser frontend --disabled-password +RUN adduser frontend --disabled-password USER frontend -HEALTHCHECK CMD ["node", "/home/frontend/healthcheck.js"] - # Use the Shell form of CMD instead of the Exec form so the environment variable is substituted # hadolint ignore=DL3025 -CMD serve --listen ${FRONTEND_PORT:-5000} --no-request-logging --single dist +HEALTHCHECK CMD wget --spider http://localhost:${FRONTEND_PORT:-5000}/favicon.ico || exit 1 +# hadolint ignore=DL3025 +CMD httpd -f -v -p ${FRONTEND_PORT:-5000} -h dist diff --git a/components/frontend/ci/quality.sh b/components/frontend/ci/quality.sh index 856c6d2301..0b593bd412 100755 --- a/components/frontend/ci/quality.sh +++ b/components/frontend/ci/quality.sh @@ -4,4 +4,4 @@ PATH="$PATH:../../ci" source quality-base.sh # Eslint -run npx eslint *.js *.mjs src +run npx eslint *.mjs src diff --git a/components/frontend/healthcheck.js b/components/frontend/healthcheck.js deleted file mode 100644 index 60fb894876..0000000000 --- a/components/frontend/healthcheck.js +++ /dev/null @@ -1,19 +0,0 @@ -const http = require("http") - -const options = { - headers: { Connection: "close" }, - host: "localhost", - method: "GET", - path: "/favicon.ico", - port: process.env.FRONTEND_PORT || 5000, -} - -const healthCheck = http.request(options, (response) => { - process.exitCode = response.statusCode == 200 ? 0 : 1 -}) - -healthCheck.on("error", function () { - process.exitCode = 1 -}) - -healthCheck.end() diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 0fdf413170..31e96989cf 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -30,6 +30,7 @@ If your currently installed *Quality-time* version is not the latest version, pl - Use the font configured in the browser instead of the browser's system font. Fixes [#9864](https://github.com/ICTU/quality-time/issues/9864). - Update SonarQube logo and documentation URLs. Closes [#10766](https://github.com/ICTU/quality-time/issues/10766). +- Use busybox as base image for the frontend component Docker image. This reduces the size of the frontend component image from 175MB to less than 6MB. Closes [#10767](https://github.com/ICTU/quality-time/issues/10767). ## v5.23.0 - 2025-01-27