From 566c44811ae5cc9ddba62b920a5b3f7a07ae38a1 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Sat, 7 Sep 2024 15:35:36 -0400 Subject: [PATCH 1/2] [REFACTOR] [CONFIG] [DOCKER] docker-compose calls replaced by new "docker compose". - Command not found: docker-compose after docker 4.32.0 update: https://stackoverflow.com/a/78788716/6366150 --- Makefile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 5e6ca78e..ccae53a8 100644 --- a/Makefile +++ b/Makefile @@ -97,35 +97,35 @@ update: dependencies outdated upgrade: update compose/build: env - docker-compose --profile lint build - docker-compose --profile testing build - docker-compose --profile production build + ${DOCKER_COMPOSE} --profile lint build + ${DOCKER_COMPOSE} --profile testing build + ${DOCKER_COMPOSE} --profile production build compose/rebuild: env - docker-compose --profile lint build --no-cache - docker-compose --profile testing build --no-cache - docker-compose --profile production build --no-cache + ${DOCKER_COMPOSE} --profile lint build --no-cache + ${DOCKER_COMPOSE} --profile testing build --no-cache + ${DOCKER_COMPOSE} --profile production build --no-cache compose/lint/markdown: compose/build - docker-compose --profile lint build - docker-compose --profile lint run --rm algorithm-exercises-js-lint make lint/markdown + ${DOCKER_COMPOSE} --profile lint build + ${DOCKER_COMPOSE} --profile lint run --rm algorithm-exercises-js-lint make lint/markdown compose/lint/yaml: compose/build - docker-compose --profile lint run --rm algorithm-exercises-js-lint make lint/yaml + ${DOCKER_COMPOSE} --profile lint run --rm algorithm-exercises-js-lint make lint/yaml compose/test/styling: compose/build - docker-compose --profile lint run --rm algorithm-exercises-js-lint make test/styling + ${DOCKER_COMPOSE} --profile lint run --rm algorithm-exercises-js-lint make test/styling compose/test/static: compose/build - docker-compose --profile lint run --rm algorithm-exercises-js-lint make test/static + ${DOCKER_COMPOSE} --profile lint run --rm algorithm-exercises-js-lint make test/static compose/lint: compose/lint/markdown compose/lint/yaml compose/test/styling compose/test/static compose/test: compose/build - docker-compose --profile testing run --rm algorithm-exercises-js-test make test + ${DOCKER_COMPOSE} --profile testing run --rm algorithm-exercises-js-test make test compose/run: compose/build - docker-compose --profile production run --rm algorithm-exercises-js make run + ${DOCKER_COMPOSE} --profile production run --rm algorithm-exercises-js make run all: env dependencies test From 420a7cc2f6f4c60e8a5db62d544c1e8703171c90 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Sat, 7 Sep 2024 15:10:11 -0400 Subject: [PATCH 2/2] [REFACTOR] [CONFIG] Dockerfile optimizations --- Dockerfile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index cfa0c30a..073b26f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ ############################################################################### FROM node:22.8.0-alpine3.20 AS base -RUN apk add --update --no-cache make -RUN apk upgrade --update --no-cache openssl libcrypto3 libssl3 # FIX CVE-2024-5535 +RUN apk add --update --no-cache make \ + && apk upgrade --update --no-cache openssl libcrypto3 libssl3 # FIX CVE-2024-5535 ENV WORKDIR=/app WORKDIR ${WORKDIR} @@ -13,10 +13,9 @@ FROM base AS lint ENV WORKDIR=/app WORKDIR ${WORKDIR} -RUN apk add --update --no-cache make nodejs npm -RUN apk add --update --no-cache yamllint - -RUN npm install -g --ignore-scripts markdownlint-cli +RUN apk add --update --no-cache make nodejs npm \ + && apk add --update --no-cache yamllint \ + && npm install -g --ignore-scripts markdownlint-cli # [!TIP] Use a bind-mount to "/app" to override following "copys" # for lint and test against "current" sources in this stage @@ -121,8 +120,8 @@ COPY ./Makefile ${WORKDIR}/ COPY ./package.json ${WORKDIR}/package.json COPY ./package-lock.json ${WORKDIR}/package-lock.json -RUN npm ci --verbose --omit=dev --omit=optional --ignore-scripts --no-cache -RUN ls -alh +RUN npm ci --verbose --omit=dev --omit=optional --ignore-scripts --no-cache \ + && ls -alh USER node CMD ["ls", "-alh"]