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/
.appends/
.github/
.gitattributes
.gitignore
Dockerfile
bin/run-in-docker.sh
bin/run-tests-in-docker.sh
tests/
output/
open-abap/
# Ignore everything to act as an allow list
*
# Include application files
!bin/run.sh
!extra/
!src/
!test/
!package-lock.json
!package.json
!tsconfig.json

View File

@@ -1,22 +1,20 @@
FROM node:lts-slim
FROM node:lts-alpine
RUN apt-get -y update
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
# Note: The docker container is run without network access
ENV NO_UPDATE_NOTIFIER=true
WORKDIR /opt/test-runner
COPY . .
RUN npm ci
RUN npm run build
RUN npm install @abaplint/cli -g
RUN npm install @abaplint/transpiler-cli -g
RUN npm install @abaplint/runtime -g
RUN apk add --no-cache --virtual .build-deps git \
&& npm ci \
&& npm run build \
&& apk del .build-deps \
# Remove build time depencies
&& 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 \
--network none \
--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=tmpfs,dst=/tmp \
--workdir /opt/test-runner \