⚡ Shrink docker image size (#228)
This commit is contained in:
@@ -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
|
||||
32
Dockerfile
32
Dockerfile
@@ -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
|
||||
ENTRYPOINT ["/opt/test-runner/bin/run.sh"]
|
||||
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"]
|
||||
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user