Shrink docker image size (#228)

This commit is contained in:
homersimpsons
2025-07-08 13:10:09 +02:00
committed by GitHub
parent c66631f60f
commit eadcf357b2
3 changed files with 27 additions and 28 deletions

View File

@@ -1,11 +1,11 @@
.git/ # Ignore everything to act as an allow list
.appends/ *
.github/
.gitattributes # Include application files
.gitignore !bin/run.sh
Dockerfile !extra/
bin/run-in-docker.sh !src/
bin/run-tests-in-docker.sh !test/
tests/ !package-lock.json
output/ !package.json
open-abap/ !tsconfig.json

View File

@@ -1,22 +1,20 @@
FROM node:lts-slim FROM node:lts-alpine
RUN apt-get -y update # Note: The docker container is run without network access
RUN apt-get -y upgrade
RUN apt-get -y install git
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
RUN npm --version
# The docker container is run without network access, so dont check for updates
ENV NO_UPDATE_NOTIFIER=true ENV NO_UPDATE_NOTIFIER=true
WORKDIR /opt/test-runner WORKDIR /opt/test-runner
COPY . . COPY . .
RUN npm ci RUN apk add --no-cache --virtual .build-deps git \
RUN npm run build && npm ci \
RUN npm install @abaplint/cli -g && npm run build \
RUN npm install @abaplint/transpiler-cli -g && apk del .build-deps \
RUN npm install @abaplint/runtime -g # Remove build time depencies
ENTRYPOINT ["/opt/test-runner/bin/run.sh"] && npm prune --omit dev \
# FIXME: These dependencies are required globally while they are included in package.json
&& npm install --global @abaplint/cli @abaplint/transpiler-cli @abaplint/runtime \
# Clean npm generated files
&& npm cache clean --force \
&& rm -rf /tmp/* /root/.npm
ENTRYPOINT ["/opt/test-runner/bin/run.sh"]

View File

@@ -20,6 +20,7 @@ docker run \
--rm \ --rm \
--network none \ --network none \
--read-only \ --read-only \
--mount type=bind,source="${PWD}/bin/run-tests.sh",destination=/opt/test-runner/bin/run-tests.sh \
--mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests \ --mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests \
--mount type=tmpfs,dst=/tmp \ --mount type=tmpfs,dst=/tmp \
--workdir /opt/test-runner \ --workdir /opt/test-runner \