mirror of https://github.com/aminya/setup-cpp
feat: add pnpm and build stage in docker files
This commit is contained in:
parent
7536d310d1
commit
b61116bffa
|
@ -1,4 +1,5 @@
|
|||
.parcel-cache/
|
||||
node_modules/
|
||||
dev/docker/
|
||||
dev/container-tests/
|
||||
dev/container-tests/
|
||||
dist/
|
|
@ -33,6 +33,7 @@ jobs:
|
|||
include:
|
||||
- node: 12
|
||||
pnpm: 6
|
||||
skip_test: true
|
||||
- node: 16
|
||||
pnpm: 7
|
||||
- node: 18
|
||||
|
@ -70,7 +71,7 @@ jobs:
|
|||
# uses: mxschmitt/action-tmate@v3
|
||||
|
||||
- name: Test
|
||||
if: "!contains(github.event.head_commit.message, '[skip test]')"
|
||||
if: "${{ !contains(github.event.head_commit.message, '[skip test]') && !${{ matrix.skip_test }} }}"
|
||||
run: |
|
||||
pnpm run test
|
||||
continue-on-error: ${{ contains(matrix.os, 'ubuntu-18.04') }}
|
||||
|
@ -113,11 +114,9 @@ jobs:
|
|||
./exe/setup-cpp-x64-windows.exe
|
||||
./exe/setup-cpp-x64-linux
|
||||
./exe/setup-cpp-x64-macos
|
||||
#./dist/node12/setup-cpp.js
|
||||
#./dist/node12/setup-cpp.js.map
|
||||
./dist/node12/setup-cpp.js
|
||||
./dist/node12/setup-cpp.js.map
|
||||
./dist/node12/ # TODO: deprecate node12
|
||||
./dist/node16/setup-cpp.js
|
||||
./dist/node16/setup-cpp.js.map
|
||||
./dist/node16/
|
||||
./dist/node18/
|
||||
|
||||
|
@ -130,12 +129,12 @@ jobs:
|
|||
os:
|
||||
- ubuntu-22.04
|
||||
container:
|
||||
- "ubuntu_node.dockerfile"
|
||||
- "ubuntu_node_legacy.dockerfile"
|
||||
- "ubuntu_20.04_node_legacy.dockerfile"
|
||||
- "ubuntu_20.04_node.dockerfile"
|
||||
- "arch_node.dockerfile"
|
||||
- "fedora_node.dockerfile"
|
||||
- "ubuntu_20.04_node_legacy.dockerfile"
|
||||
- "ubuntu_20.04_node.dockerfile"
|
||||
- "ubuntu_node_legacy.dockerfile"
|
||||
- "ubuntu_node.dockerfile"
|
||||
cache_reset_counter:
|
||||
- 0
|
||||
steps:
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 467e5baf5e5caff2a6462581f7c2b0ca62d9af8c
|
||||
Subproject commit b10f2e841835b93cee67dff1eb70d6fa5c0ac0cd
|
|
@ -4,35 +4,44 @@ FROM archlinux as base
|
|||
RUN pacman -Syuu --noconfirm
|
||||
RUN pacman-db-upgrade
|
||||
|
||||
# nodejs
|
||||
# install nodejs
|
||||
RUN pacman -S --noconfirm --needed nodejs
|
||||
|
||||
# curl for downloading setup-cpp
|
||||
RUN pacman -S --noconfirm --needed curl
|
||||
# install pnpm
|
||||
#RUN pacman -S --noconfirm --needed pnpm
|
||||
RUN npm install -g pnpm
|
||||
|
||||
|
||||
#### 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 "./dist/node16" "/"
|
||||
WORKDIR "/"
|
||||
|
||||
COPY --from=builder /workspace/dist/node18 /
|
||||
# run installation
|
||||
RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task 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"]
|
||||
|
||||
|
||||
#### Building
|
||||
FROM base as builder
|
||||
#### 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
|
||||
#### 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=builder /home/app/build/my_exe/Release/ /home/app/
|
||||
COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/
|
||||
WORKDIR /home/app/
|
||||
ENTRYPOINT ["./my_exe"]
|
||||
|
|
|
@ -4,29 +4,40 @@ FROM fedora as base
|
|||
# nodejs and curl for downloading setup-cpp
|
||||
RUN dnf -y install nodejs curl
|
||||
|
||||
# add setup-cpp.js
|
||||
COPY "./dist/node16" "/"
|
||||
WORKDIR "/"
|
||||
|
||||
# run installation
|
||||
RUN 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" ]
|
||||
# install pnpm
|
||||
RUN npm install -g pnpm
|
||||
|
||||
|
||||
#### Building
|
||||
FROM base as builder
|
||||
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/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
|
||||
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
|
||||
#### 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=builder /home/app/build/my_exe/Release/ /home/app/
|
||||
COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/
|
||||
WORKDIR /home/app/
|
||||
ENTRYPOINT ["./my_exe"]
|
||||
|
|
|
@ -19,30 +19,40 @@ RUN chmod +x /nvm_install.sh && /nvm_install.sh \
|
|||
ENV NODE_PATH $NVM_DIR/v${node_version}/lib/node_modules
|
||||
ENV PATH $NVM_DIR/versions/node/v${node_version}/bin:$PATH
|
||||
|
||||
# install pnpm
|
||||
RUN npm install -g pnpm@7.32.0
|
||||
|
||||
|
||||
#### 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 "./dist/node16" "/"
|
||||
WORKDIR "/"
|
||||
|
||||
COPY --from=builder /workspace/dist/node16 /
|
||||
# run installation
|
||||
RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task 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"]
|
||||
|
||||
|
||||
#### Building
|
||||
FROM base as builder
|
||||
#### 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:20.04 if you wish
|
||||
#### 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=builder /home/app/build/my_exe/Release/ /home/app/
|
||||
COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/
|
||||
WORKDIR /home/app/
|
||||
ENTRYPOINT ["./my_exe"]
|
||||
|
|
|
@ -19,29 +19,40 @@ RUN chmod +x /nvm_install.sh && /nvm_install.sh \
|
|||
ENV NODE_PATH $NVM_DIR/v${node_version}/lib/node_modules
|
||||
ENV PATH $NVM_DIR/versions/node/v${node_version}/bin:$PATH
|
||||
|
||||
# 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 "./dist/node12" "/"
|
||||
WORKDIR "/"
|
||||
|
||||
COPY --from=builder /workspace/dist/node12 /
|
||||
# run installation
|
||||
RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task 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"]
|
||||
|
||||
|
||||
#### Building
|
||||
FROM base as builder
|
||||
#### 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:20.04 if you wish
|
||||
#### 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=builder /home/app/build/my_exe/Release/ /home/app/
|
||||
COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/
|
||||
WORKDIR /home/app/
|
||||
ENTRYPOINT ["./my_exe"]
|
||||
|
|
|
@ -6,8 +6,8 @@ ARG nvm_version="0.39.3"
|
|||
ARG node_version="18.15.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 \
|
||||
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 \
|
||||
&& nvm install $node_version \
|
||||
&& nvm alias default $node_version \
|
||||
|
@ -15,29 +15,40 @@ RUN chmod +x /nvm_install.sh && /nvm_install.sh \
|
|||
ENV NODE_PATH $NVM_DIR/v${node_version}/lib/node_modules
|
||||
ENV PATH $NVM_DIR/versions/node/v${node_version}/bin:$PATH
|
||||
|
||||
# add setup-cpp.js
|
||||
COPY "./dist/node16" "/"
|
||||
WORKDIR "/"
|
||||
|
||||
# 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" ]
|
||||
# install pnpm
|
||||
RUN npm install -g pnpm
|
||||
|
||||
|
||||
#### 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/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
|
||||
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
|
||||
#### 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=builder /home/app/build/my_exe/Release/ /home/app/
|
||||
COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/
|
||||
WORKDIR /home/app/
|
||||
ENTRYPOINT ["./my_exe"]
|
||||
|
|
|
@ -3,29 +3,39 @@ FROM ubuntu:22.04 AS base
|
|||
RUN apt-get update -qq
|
||||
RUN apt-get install -y --no-install-recommends nodejs
|
||||
|
||||
# add setup-cpp.js
|
||||
COPY "./dist/node12" "/"
|
||||
WORKDIR "/"
|
||||
|
||||
# run installation
|
||||
RUN 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" ]
|
||||
|
||||
# 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
|
||||
#### 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=builder /home/app/build/my_exe/Release/ /home/app/
|
||||
COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/
|
||||
WORKDIR /home/app/
|
||||
ENTRYPOINT ["./my_exe"]
|
||||
|
|
|
@ -55,9 +55,9 @@
|
|||
"start.docker.fedora": "docker run -t setup-cpp:fedora .",
|
||||
"start.docker.ubuntu": "docker run -t setup-cpp:ubuntu .",
|
||||
"test": "run-p --continue-on-error test.lint test.unit",
|
||||
"test.docker.arch": "docker build -f ./dev/docker/arch_node.dockerfile --target base -t setup-cpp:arch-base . && container-structure-test test --image setup-cpp:arch-base --config ./dev/container-tests/arch.yml",
|
||||
"test.docker.fedora": "docker build -f ./dev/docker/fedora_node.dockerfile --target base -t setup-cpp:fedora-base . && container-structure-test test --image setup-cpp:fedora-base --config ./dev/container-tests/fedora.yml",
|
||||
"test.docker.ubuntu": "docker build -f ./dev/docker/ubuntu_node.dockerfile --target base -t setup-cpp:ubuntu-base . && container-structure-test test --image setup-cpp:ubuntu-base --config ./dev/container-tests/ubuntu.yml",
|
||||
"test.docker.arch": "docker build -f ./dev/docker/arch_node.dockerfile --target setup-cpp -t setup-cpp:arch-base . && container-structure-test test --image setup-cpp:arch-base --config ./dev/container-tests/arch.yml",
|
||||
"test.docker.fedora": "docker build -f ./dev/docker/fedora_node.dockerfile --target setup-cpp -t setup-cpp:fedora-base . && container-structure-test test --image setup-cpp:fedora-base --config ./dev/container-tests/fedora.yml",
|
||||
"test.docker.ubuntu": "docker build -f ./dev/docker/ubuntu_node.dockerfile --target setup-cpp -t setup-cpp:ubuntu-base . && container-structure-test test --image setup-cpp:ubuntu-base --config ./dev/container-tests/ubuntu.yml",
|
||||
"test.lint": "run-p --aggregate-output --continue-on-error lint.cspell test.lint.eslint test.lint.prettier lint.tsc",
|
||||
"test.lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/",
|
||||
"test.lint.prettier": "prettier . --check",
|
||||
|
|
Loading…
Reference in New Issue