Skip to content

Commit c676334

Browse files
committed
⚡ Shrink docker image size
1 parent c66631f commit c676334

File tree

3 files changed

+27
-28
lines changed

3 files changed

+27
-28
lines changed

.dockerignore

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
.git/
2-
.appends/
3-
.github/
4-
.gitattributes
5-
.gitignore
6-
Dockerfile
7-
bin/run-in-docker.sh
8-
bin/run-tests-in-docker.sh
9-
tests/
10-
output/
11-
open-abap/
1+
# Ignore everything to act as an allow list
2+
*
3+
4+
# Include application files
5+
!bin/run.sh
6+
!extra/
7+
!src/
8+
!test/
9+
!package-lock.json
10+
!package.json
11+
!tsconfig.json

Dockerfile

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
FROM node:lts-slim
1+
FROM node:lts-alpine
22

3-
RUN apt-get -y update
4-
RUN apt-get -y upgrade
5-
RUN apt-get -y install git
6-
RUN apt-get clean
7-
RUN rm -rf /var/lib/apt/lists/*
8-
9-
10-
RUN npm --version
11-
12-
# The docker container is run without network access, so dont check for updates
3+
# Note: The docker container is run without network access
134
ENV NO_UPDATE_NOTIFIER=true
145

156
WORKDIR /opt/test-runner
167
COPY . .
17-
RUN npm ci
18-
RUN npm run build
19-
RUN npm install @abaplint/cli -g
20-
RUN npm install @abaplint/transpiler-cli -g
21-
RUN npm install @abaplint/runtime -g
22-
ENTRYPOINT ["/opt/test-runner/bin/run.sh"]
8+
RUN apk add --no-cache --virtual .build-deps git \
9+
&& npm ci \
10+
&& npm run build \
11+
&& apk del .build-deps \
12+
# Remove build time depencies
13+
&& npm prune --omit dev \
14+
# FIXME: These dependencies are required globally while they are included in package.json
15+
&& npm install --global @abaplint/cli @abaplint/transpiler-cli @abaplint/runtime \
16+
# Clean npm generated files
17+
&& npm cache clean --force \
18+
&& rm -rf /tmp/* /root/.npm
19+
20+
ENTRYPOINT ["/opt/test-runner/bin/run.sh"]

bin/run-tests-in-docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ docker run \
2020
--rm \
2121
--network none \
2222
--read-only \
23+
--mount type=bind,source="${PWD}/bin/run-tests.sh",destination=/opt/test-runner/bin/run-tests.sh \
2324
--mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests \
2425
--mount type=tmpfs,dst=/tmp \
2526
--workdir /opt/test-runner \

0 commit comments

Comments
 (0)