mirror of https://github.com/aminya/setup-cpp
parent
088ef837cc
commit
4556f8870e
|
@ -162,9 +162,8 @@ 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
|
||||
RUN apt-get update && apt-get install -y \
|
||||
npm \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update -qq
|
||||
RUN apt-get install -y --no-install-recommends npm
|
||||
RUN npm install -g setup-cpp
|
||||
|
||||
# install llvm, cmake, ninja, and ccache
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
#### Base Image
|
||||
FROM ubuntu:22.04 AS base
|
||||
FROM ubuntu:22.04 as base
|
||||
|
||||
# install setup-cpp
|
||||
RUN apt-get update && apt-get install -y \
|
||||
npm \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update -qq
|
||||
RUN apt-get install -y --no-install-recommends npm
|
||||
RUN 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
|
||||
|
||||
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/
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
FROM ubuntu:22.04 AS base
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update -qq
|
||||
RUN apt-get install -y --no-install-recommends nodejs
|
||||
|
||||
# add setup-cpp.js
|
||||
COPY "./dist/node12" "/"
|
||||
|
@ -11,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
|
||||
|
@ -25,10 +21,11 @@ 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/
|
||||
ENTRYPOINT ["./my_exe"]
|
||||
ENTRYPOINT ["./my_exe"]s
|
||||
|
|
Loading…
Reference in New Issue