diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 438d1bee..c810a431 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -135,9 +135,6 @@ jobs: container: - "arch_node.dockerfile" - "fedora_node.dockerfile" - - "ubuntu_20.04_node_legacy.dockerfile" - - "ubuntu_20.04_node.dockerfile" - - "ubuntu_node_legacy.dockerfile" - "ubuntu_node.dockerfile" steps: - uses: actions/checkout@v3 diff --git a/dev/cpp_vcpkg_project b/dev/cpp_vcpkg_project index c3058919..b10f2e84 160000 --- a/dev/cpp_vcpkg_project +++ b/dev/cpp_vcpkg_project @@ -1 +1 @@ -Subproject commit c30589196b2c59a3055dfc7c24244b4a1f48b081 +Subproject commit b10f2e841835b93cee67dff1eb70d6fa5c0ac0cd diff --git a/dev/docker/arch_node.dockerfile b/dev/docker/arch_node.dockerfile index 55359cd2..002366c9 100644 --- a/dev/docker/arch_node.dockerfile +++ b/dev/docker/arch_node.dockerfile @@ -1,15 +1,9 @@ ## base image FROM archlinux as base -RUN pacman -Syuu --noconfirm -RUN pacman-db-upgrade - -# install nodejs -RUN pacman -S --noconfirm --needed nodejs npm git - -# install pnpm -#RUN pacman -S --noconfirm --needed pnpm -RUN npm install -g pnpm +# install nodejs and pnpm +RUN pacman -Syuu --noconfirm && pacman-db-upgrade && pacman -S --noconfirm --needed nodejs npm git \ + && npm install -g pnpm #### Building diff --git a/dev/docker/fedora_node.dockerfile b/dev/docker/fedora_node.dockerfile index 0f58e33e..46c0d4d6 100644 --- a/dev/docker/fedora_node.dockerfile +++ b/dev/docker/fedora_node.dockerfile @@ -2,10 +2,8 @@ FROM fedora as base # nodejs and curl for downloading setup-cpp -RUN dnf -y install nodejs npm curl git - -# install pnpm -RUN npm install -g pnpm +RUN dnf -y install nodejs npm curl git && dnf clean all \ + && npm install -g pnpm #### Building diff --git a/dev/docker/ubuntu.dockerfile b/dev/docker/ubuntu.dockerfile index 38356319..5f8acaba 100644 --- a/dev/docker/ubuntu.dockerfile +++ b/dev/docker/ubuntu.dockerfile @@ -2,11 +2,10 @@ FROM ubuntu:22.04 as base # install setup-cpp -RUN apt-get update -qq && apt-get install -y --no-install-recommends npm git curl -RUN npm install -g setup-cpp - +RUN apt-get update -qq && apt-get install -y --no-install-recommends npm git curl && rm -rf /var/lib/apt/lists/* \ + && npm install -g setup-cpp \ # install llvm, cmake, ninja, and ccache -RUN setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true + && setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true CMD ["source", "~/.cpprc"] ENTRYPOINT ["/bin/bash"] diff --git a/dev/docker/ubuntu_20.04_node.dockerfile b/dev/docker/ubuntu_20.04_node.dockerfile deleted file mode 100644 index 079b806f..00000000 --- a/dev/docker/ubuntu_20.04_node.dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -FROM ubuntu:20.04 as base - -# set time-zone -ENV TZ=Canada/Pacific -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -# install node with nvm -RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates -ARG nvm_version="0.39.3" -ARG node_version="16.20.0" -RUN mkdir /usr/local/nvm -ENV NVM_DIR /usr/local/nvm -ADD https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh /nvm_install.sh -RUN chmod +x /nvm_install.sh && /nvm_install.sh \ - && . $NVM_DIR/nvm.sh \ - && nvm install $node_version \ - && nvm alias default $node_version \ - && nvm use default -ENV NODE_PATH $NVM_DIR/v${node_version}/lib/node_modules -ENV PATH $NVM_DIR/versions/node/v${node_version}/bin:$PATH - -# install pnpm -ENV PNPM_VERSION "7.32.0" -ADD https://get.pnpm.io/install.sh /tmp/pnpm_install.sh -RUN chmod +x /tmp/pnpm_install.sh && bash /tmp/pnpm_install.sh -ENV PNPM_HOME "/root/.local/share/pnpm" -ENV PATH "${PATH}:${PNPM_HOME}" - - -#### Building -FROM base AS builder -## https://github.com/ever0de/pnpm-docker-root-bug#how-to-fix -WORKDIR /workspace -COPY . . -RUN pnpm install - - -#### setup-cpp -FROM base AS setup-cpp -# add setup-cpp.js -COPY --from=builder /workspace/dist/node16 / -# run installation -RUN . $NVM_DIR/nvm.sh && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true -CMD ["source", "~/.cpprc"] -ENTRYPOINT ["/bin/bash"] - - -#### Building (example) -FROM setup-cpp AS example-builder -COPY ./dev/cpp_vcpkg_project /home/app -WORKDIR /home/app -RUN bash -c 'source ~/.cpprc \ - && task build' - - -#### Running environment -# use a distroless image or ubuntu:22.04 if you wish -FROM gcr.io/distroless/cc as runner -# copy the built binaries and their runtime dependencies -COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/ -WORKDIR /home/app/ -ENTRYPOINT ["./my_exe"] diff --git a/dev/docker/ubuntu_20.04_node_legacy.dockerfile b/dev/docker/ubuntu_20.04_node_legacy.dockerfile deleted file mode 100644 index f54bd2d2..00000000 --- a/dev/docker/ubuntu_20.04_node_legacy.dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -FROM ubuntu:20.04 as base - -# set time-zone -ENV TZ=Canada/Pacific -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -# install node with nvm -RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates -ARG nvm_version="0.39.3" -ARG node_version="12.22.12" -RUN mkdir /usr/local/nvm -ENV NVM_DIR /usr/local/nvm -ADD https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh /nvm_install.sh -RUN chmod +x /nvm_install.sh && /nvm_install.sh \ - && . $NVM_DIR/nvm.sh \ - && nvm install $node_version \ - && nvm alias default $node_version \ - && nvm use default -ENV NODE_PATH $NVM_DIR/v${node_version}/lib/node_modules -ENV PATH $NVM_DIR/versions/node/v${node_version}/bin:$PATH - -# install pnpm -ENV PNPM_VERSION "6.35.1" -ADD https://get.pnpm.io/install.sh /tmp/pnpm_install.sh -RUN chmod +x /tmp/pnpm_install.sh && bash /tmp/pnpm_install.sh -ENV PNPM_HOME "/root/.local/share/pnpm" -ENV PATH "${PATH}:${PNPM_HOME}" - - -#### Building -FROM base AS builder -## https://github.com/ever0de/pnpm-docker-root-bug#how-to-fix -WORKDIR /workspace -COPY . . -## WARN  "prepare" script of "setup-cpp" inside "/workspace" is skipped as the working directory seems suspicious. To run this lifecycle script anyway, use "--unsafe-perm". -RUN pnpm install --unsafe-perm - - -#### setup-cpp -FROM base AS setup-cpp -# add setup-cpp.js -COPY --from=builder /workspace/dist/node12 / -# run installation -RUN . $NVM_DIR/nvm.sh && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true -CMD ["source", "~/.cpprc"] -ENTRYPOINT ["/bin/bash"] - - -#### Building (example) -FROM setup-cpp AS example-builder -COPY ./dev/cpp_vcpkg_project /home/app -WORKDIR /home/app -RUN bash -c 'source ~/.cpprc \ - && task build' - - -#### Running environment -# use a distroless image or ubuntu:22.04 if you wish -FROM gcr.io/distroless/cc as runner -# copy the built binaries and their runtime dependencies -COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/ -WORKDIR /home/app/ -ENTRYPOINT ["./my_exe"] diff --git a/dev/docker/ubuntu_node.dockerfile b/dev/docker/ubuntu_node.dockerfile index 8d207bc8..abea3290 100644 --- a/dev/docker/ubuntu_node.dockerfile +++ b/dev/docker/ubuntu_node.dockerfile @@ -1,11 +1,11 @@ FROM ubuntu:22.04 AS base # install node with nvm -RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates +RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates && rm -rf /var/lib/apt/lists/* ARG nvm_version="0.39.3" ARG node_version="18.15.0" -RUN mkdir /usr/local/nvm ENV NVM_DIR /usr/local/nvm +RUN mkdir $NVM_DIR ADD https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh /tmp/nvm_install.sh RUN chmod +x /tmp/nvm_install.sh && /tmp/nvm_install.sh \ && . $NVM_DIR/nvm.sh \ @@ -16,10 +16,7 @@ ENV NODE_PATH $NVM_DIR/v${node_version}/lib/node_modules ENV PATH $NVM_DIR/versions/node/v${node_version}/bin:$PATH # install pnpm -ADD https://get.pnpm.io/install.sh /tmp/pnpm_install.sh -RUN chmod +x /tmp/pnpm_install.sh && bash /tmp/pnpm_install.sh -ENV PNPM_HOME "/root/.local/share/pnpm" -ENV PATH "${PATH}:${PNPM_HOME}" +RUN npm install -g pnpm #### Building @@ -35,7 +32,7 @@ FROM base AS setup-cpp # add setup-cpp.js COPY --from=builder /workspace/dist/node18 / # run installation -RUN . $NVM_DIR/nvm.sh && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true +RUN . "${NVM_DIR}/nvm.sh" && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true CMD ["source", "~/.cpprc"] ENTRYPOINT ["/bin/bash"] diff --git a/dev/docker/ubuntu_node_legacy.dockerfile b/dev/docker/ubuntu_node_legacy.dockerfile deleted file mode 100644 index c7f41f69..00000000 --- a/dev/docker/ubuntu_node_legacy.dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -FROM ubuntu:22.04 AS base - -RUN apt-get update -qq && apt-get install -y --no-install-recommends nodejs npm - -# install pnpm -RUN npm install -g pnpm@6.35.1 - -#### Building -FROM base AS builder -## https://github.com/ever0de/pnpm-docker-root-bug#how-to-fix -WORKDIR /workspace -COPY . . -RUN pnpm install - - -#### setup-cpp -FROM base AS setup-cpp -# add setup-cpp.js -COPY --from=builder /workspace/dist/node12 / -# run installation -RUN . $NVM_DIR/nvm.sh && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true -CMD ["source", "~/.cpprc"] -ENTRYPOINT ["/bin/bash"] - - -#### Building (example) -FROM setup-cpp AS example-builder -COPY ./dev/cpp_vcpkg_project /home/app -WORKDIR /home/app -RUN bash -c 'source ~/.cpprc \ - && task build' - - -#### Running environment -# use a distroless image or ubuntu:22.04 if you wish -FROM gcr.io/distroless/cc as runner -# copy the built binaries and their runtime dependencies -COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/ -WORKDIR /home/app/ -ENTRYPOINT ["./my_exe"]