tests: remove npm install in docker tests

This commit is contained in:
Amin Yahyaabadi 2023-07-17 10:27:35 -07:00
parent 71e227aa5f
commit f1d59251fb
5 changed files with 7 additions and 8 deletions

View File

@ -209,7 +209,7 @@ If you want to build the ones included, then run:
```shell
git clone --recurse-submodules https://github.com/aminya/setup-cpp
cd ./setup-cpp
docker build -f ./dev/docker/setup-cpp-ubuntu.dockerfile -t setup-cpp .
docker build -f ./dev/docker/setup-cpp-ubuntu.dockerfile -t setup-cpp-ubuntu .
```
Where you should use the path to the dockerfile after `-f`.

View File

@ -7,8 +7,7 @@ RUN pacman -Syuu --noconfirm && \
pacman-db-upgrade && \
# install nodejs
pacman -S --noconfirm --needed nodejs npm && \
# install setup-cpp
npm install -g setup-cpp@v0.31.1 && \
# install the compiler and tools
node /usr/lib/setup-cpp/setup-cpp.js \
--compiler llvm \

View File

@ -5,8 +5,7 @@ COPY "./dist/legacy" "/usr/lib/setup-cpp/"
# install nodejs
RUN dnf -y install nodejs npm && \
# install setup-cpp
npm install -g setup-cpp@v0.31.1 && \
# install the compiler and tools
node /usr/lib/setup-cpp/setup-cpp.js \
--compiler llvm \

View File

@ -6,8 +6,7 @@ COPY "./dist/legacy" "/usr/lib/setup-cpp/"
RUN apt-get update -qq && \
# install nodejs
apt-get install -y --no-install-recommends nodejs npm && \
# install setup-cpp
npm install -g setup-cpp@v0.31.1 && \
# install the compiler and tools
node /usr/lib/setup-cpp/setup-cpp.js \
--nala true \

View File

@ -7,10 +7,12 @@ async function main() {
const dockerFileContent = await readFile(`./dev/docker/setup-cpp-${dockerFile}.dockerfile`, "utf-8")
const builderExample = await readFile(`./dev/docker/${dockerFile}.dockerfile`, "utf-8")
// after the first FROM, add COPY "./dist/legacy" "/"
const modifiedDockerFile = dockerFileContent
// load the externally built setup-cpp
.replace(/FROM (.*)/g, `FROM $1\n\nCOPY "./dist/legacy" "/usr/lib/setup-cpp/"`)
.replace("setup-cpp ", "node /usr/lib/setup-cpp/setup-cpp.js ")
// remove the npm install line
.replace(/# install setup-cpp\n\s*npm install -g setup-cpp.*/, "")
// concat the two files
const newDockerFileContent = `${modifiedDockerFile}\n${builderExample}`