Merge pull request #161 from abeimler/fix/docker-new-setup-cpp-npm [skip ci]

This commit is contained in:
Amin Yahyaabadi 2023-01-19 13:55:34 -08:00 committed by GitHub
commit a0b095eede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 48 deletions

View File

@ -162,14 +162,12 @@ Here is an example for using setup-cpp to make a builder image that has the Cpp
FROM ubuntu:22.04 AS base
# add setup-cpp
WORKDIR "/"
RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends wget
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.26.1/setup-cpp-x64-linux"
RUN chmod +x ./setup-cpp-x64-linux
RUN apt-get install -y --no-install-recommends npm
RUN npm install -g setup-cpp
# install llvm, cmake, ninja, and ccache
RUN ./setup-cpp-x64-linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --make true
RUN setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --make true
CMD source ~/.cpprc
ENTRYPOINT [ "/bin/bash" ]

View File

@ -17,23 +17,21 @@ 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
# clean up
RUN pacman -Scc --noconfirm
RUN rm -rf /tmp/*
CMD ["source", "~/.cpprc"]
ENTRYPOINT ["/bin/bash"]
CMD source ~/.cpprc
ENTRYPOINT [ "/bin/bash" ]
#### Building
FROM base AS builder
FROM base as 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
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/
WORKDIR /home/app/

View File

@ -1,11 +1,8 @@
## base image
FROM fedora as base
# nodejs
RUN dnf -y install nodejs
# curl for downloading setup-cpp
RUN dnf -y install curl
# nodejs and curl for downloading setup-cpp
RUN dnf -y install nodejs curl
# add setup-cpp.js
COPY "./dist/node12" "/"
@ -14,22 +11,21 @@ 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
# clean up
RUN rm -rf /tmp/*
CMD source ~/.cpprc
CMD ["source", "~/.cpprc"]
ENTRYPOINT [ "/bin/bash" ]
#### Building
FROM base AS builder
FROM base as 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
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/
WORKDIR /home/app/

View File

@ -1,29 +1,29 @@
#### Base Image
FROM ubuntu:22.04 AS base
FROM ubuntu:22.04 as base
# add setup-cpp
WORKDIR "/"
# install setup-cpp
RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends wget
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.26.1/setup-cpp-x64-linux"
RUN chmod +x ./setup-cpp-x64-linux
RUN apt-get install -y --no-install-recommends npm
RUN npm install -g setup-cpp
# install llvm, cmake, ninja, and ccache
RUN ./setup-cpp-x64-linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true
RUN setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true
CMD ["source", "~/.cpprc"]
ENTRYPOINT ["/bin/bash"]
CMD source ~/.cpprc
ENTRYPOINT [ "/bin/bash" ]
#### Building
FROM base AS builder
ADD ./dev/cpp_vcpkg_project /home/app
FROM base as 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
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/
WORKDIR /home/app/

View File

@ -1,4 +1,4 @@
FROM ubuntu:20.04 AS base
FROM ubuntu:20.04 as base
# set time-zone
ENV TZ=Canada/Pacific
@ -8,7 +8,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends curl gnupg ca-certificates
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN ["/bin/bash", "-c", "set -o pipefail && curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -"]
RUN apt-get install -y --no-install-recommends nodejs
# add setup-cpp.js
@ -18,19 +18,21 @@ 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
CMD source ~/.cpprc
ENTRYPOINT [ "/bin/bash" ]
CMD ["source", "~/.cpprc"]
ENTRYPOINT ["/bin/bash"]
#### Building
FROM base AS builder
ADD ./dev/cpp_vcpkg_project /home/app
FROM base as 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
FROM gcr.io/distroless/cc
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/
WORKDIR /home/app/

View File

@ -10,13 +10,10 @@ 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
# clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN rm -rf /tmp/*
CMD source ~/.cpprc
CMD ["source", "~/.cpprc"]
ENTRYPOINT [ "/bin/bash" ]
#### Building
FROM base AS builder
COPY ./dev/cpp_vcpkg_project /home/app
@ -24,9 +21,10 @@ 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
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/
WORKDIR /home/app/