Skip to content

Commit d03cc40

Browse files
authored
Merge pull request #526 from sir-gon/develop
[REFACTOR] [CONFIG] Dockerfile optimizations
2 parents 768975d + 420a7cc commit d03cc40

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

Dockerfile

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
###############################################################################
22
FROM node:22.8.0-alpine3.20 AS base
33

4-
RUN apk add --update --no-cache make
5-
RUN apk upgrade --update --no-cache openssl libcrypto3 libssl3 # FIX CVE-2024-5535
4+
RUN apk add --update --no-cache make \
5+
&& apk upgrade --update --no-cache openssl libcrypto3 libssl3 # FIX CVE-2024-5535
66

77
ENV WORKDIR=/app
88
WORKDIR ${WORKDIR}
@@ -13,10 +13,9 @@ FROM base AS lint
1313
ENV WORKDIR=/app
1414
WORKDIR ${WORKDIR}
1515

16-
RUN apk add --update --no-cache make nodejs npm
17-
RUN apk add --update --no-cache yamllint
18-
19-
RUN npm install -g --ignore-scripts markdownlint-cli
16+
RUN apk add --update --no-cache make nodejs npm \
17+
&& apk add --update --no-cache yamllint \
18+
&& npm install -g --ignore-scripts markdownlint-cli
2019

2120
# [!TIP] Use a bind-mount to "/app" to override following "copys"
2221
# for lint and test against "current" sources in this stage
@@ -121,8 +120,8 @@ COPY ./Makefile ${WORKDIR}/
121120
COPY ./package.json ${WORKDIR}/package.json
122121
COPY ./package-lock.json ${WORKDIR}/package-lock.json
123122

124-
RUN npm ci --verbose --omit=dev --omit=optional --ignore-scripts --no-cache
125-
RUN ls -alh
123+
RUN npm ci --verbose --omit=dev --omit=optional --ignore-scripts --no-cache \
124+
&& ls -alh
126125

127126
USER node
128127
CMD ["ls", "-alh"]

Makefile

+13-13
Original file line numberDiff line numberDiff line change
@@ -97,35 +97,35 @@ update: dependencies outdated
9797
upgrade: update
9898

9999
compose/build: env
100-
docker-compose --profile lint build
101-
docker-compose --profile testing build
102-
docker-compose --profile production build
100+
${DOCKER_COMPOSE} --profile lint build
101+
${DOCKER_COMPOSE} --profile testing build
102+
${DOCKER_COMPOSE} --profile production build
103103

104104
compose/rebuild: env
105-
docker-compose --profile lint build --no-cache
106-
docker-compose --profile testing build --no-cache
107-
docker-compose --profile production build --no-cache
105+
${DOCKER_COMPOSE} --profile lint build --no-cache
106+
${DOCKER_COMPOSE} --profile testing build --no-cache
107+
${DOCKER_COMPOSE} --profile production build --no-cache
108108

109109
compose/lint/markdown: compose/build
110-
docker-compose --profile lint build
111-
docker-compose --profile lint run --rm algorithm-exercises-js-lint make lint/markdown
110+
${DOCKER_COMPOSE} --profile lint build
111+
${DOCKER_COMPOSE} --profile lint run --rm algorithm-exercises-js-lint make lint/markdown
112112

113113
compose/lint/yaml: compose/build
114-
docker-compose --profile lint run --rm algorithm-exercises-js-lint make lint/yaml
114+
${DOCKER_COMPOSE} --profile lint run --rm algorithm-exercises-js-lint make lint/yaml
115115

116116
compose/test/styling: compose/build
117-
docker-compose --profile lint run --rm algorithm-exercises-js-lint make test/styling
117+
${DOCKER_COMPOSE} --profile lint run --rm algorithm-exercises-js-lint make test/styling
118118

119119
compose/test/static: compose/build
120-
docker-compose --profile lint run --rm algorithm-exercises-js-lint make test/static
120+
${DOCKER_COMPOSE} --profile lint run --rm algorithm-exercises-js-lint make test/static
121121

122122
compose/lint: compose/lint/markdown compose/lint/yaml compose/test/styling compose/test/static
123123

124124
compose/test: compose/build
125-
docker-compose --profile testing run --rm algorithm-exercises-js-test make test
125+
${DOCKER_COMPOSE} --profile testing run --rm algorithm-exercises-js-test make test
126126

127127
compose/run: compose/build
128-
docker-compose --profile production run --rm algorithm-exercises-js make run
128+
${DOCKER_COMPOSE} --profile production run --rm algorithm-exercises-js make run
129129

130130
all: env dependencies test
131131

0 commit comments

Comments
 (0)