File tree Expand file tree Collapse file tree 6 files changed +40
-48
lines changed
Expand file tree Collapse file tree 6 files changed +40
-48
lines changed Original file line number Diff line number Diff line change @@ -162,14 +162,12 @@ Here is an example for using setup-cpp to make a builder image that has the Cpp
162162FROM ubuntu:22.04 AS base
163163
164164# add setup-cpp
165- WORKDIR "/"
166165RUN apt-get update -qq
167- RUN apt-get install -y --no-install-recommends wget
168- RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.26.1/setup-cpp-x64-linux"
169- RUN chmod +x ./setup-cpp-x64-linux
166+ RUN apt-get install -y --no-install-recommends npm
167+ RUN npm install -g setup-cpp
170168
171169# install llvm, cmake, ninja, and ccache
172- RUN ./ setup-cpp-x64-linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --make true
170+ RUN setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --make true
173171
174172CMD source ~/.cpprc
175173ENTRYPOINT [ "/bin/bash" ]
Original file line number Diff line number Diff line change @@ -17,23 +17,21 @@ WORKDIR "/"
1717# run installation
1818RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
1919
20- # clean up
21- RUN pacman -Scc --noconfirm
22- RUN rm -rf /tmp/*
20+ CMD ["source" , "~/.cpprc" ]
21+ ENTRYPOINT ["/bin/bash" ]
2322
24- CMD source ~/.cpprc
25- ENTRYPOINT [ "/bin/bash" ]
2623
2724# ### Building
28- FROM base AS builder
25+ FROM base as builder
2926COPY ./dev/cpp_vcpkg_project /home/app
3027WORKDIR /home/app
3128RUN bash -c 'source ~/.cpprc \
3229 && task build'
3330
31+
3432# ## Running environment
3533# use a distroless image or ubuntu:22.04 if you wish
36- FROM gcr.io/distroless/cc
34+ FROM gcr.io/distroless/cc as runner
3735# copy the built binaries and their runtime dependencies
3836COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3937WORKDIR /home/app/
Original file line number Diff line number Diff line change 11# # base image
22FROM fedora as base
33
4- # nodejs
5- RUN dnf -y install nodejs
6-
7- # curl for downloading setup-cpp
8- RUN dnf -y install curl
4+ # nodejs and curl for downloading setup-cpp
5+ RUN dnf -y install nodejs curl
96
107# add setup-cpp.js
118COPY "./dist/node12" "/"
@@ -14,22 +11,21 @@ WORKDIR "/"
1411# run installation
1512RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
1613
17- # clean up
18- RUN rm -rf /tmp/*
19-
20- CMD source ~/.cpprc
14+ CMD ["source" , "~/.cpprc" ]
2115ENTRYPOINT [ "/bin/bash" ]
2216
17+
2318# ### Building
24- FROM base AS builder
19+ FROM base as builder
2520COPY ./dev/cpp_vcpkg_project /home/app
2621WORKDIR /home/app
2722RUN bash -c 'source ~/.cpprc \
2823 && task build'
2924
25+
3026# ## Running environment
3127# use a distroless image or ubuntu:22.04 if you wish
32- FROM gcr.io/distroless/cc
28+ FROM gcr.io/distroless/cc as runner
3329# copy the built binaries and their runtime dependencies
3430COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3531WORKDIR /home/app/
Original file line number Diff line number Diff line change 11# ### Base Image
2- FROM ubuntu:22.04 AS base
2+ FROM ubuntu:22.04 as base
33
4- # add setup-cpp
5- WORKDIR "/"
4+ # install setup-cpp
65RUN apt-get update -qq
7- RUN apt-get install -y --no-install-recommends wget
8- RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.26.1/setup-cpp-x64-linux"
9- RUN chmod +x ./setup-cpp-x64-linux
6+ RUN apt-get install -y --no-install-recommends npm
7+ RUN npm install -g setup-cpp
108
119# install llvm, cmake, ninja, and ccache
12- RUN ./setup-cpp-x64-linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true
10+ RUN setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true
11+
12+ CMD ["source" , "~/.cpprc" ]
13+ ENTRYPOINT ["/bin/bash" ]
1314
14- CMD source ~/.cpprc
15- ENTRYPOINT [ "/bin/bash" ]
1615
1716# ### Building
18- FROM base AS builder
19- ADD ./dev/cpp_vcpkg_project /home/app
17+ FROM base as builder
18+ COPY ./dev/cpp_vcpkg_project /home/app
2019WORKDIR /home/app
2120RUN bash -c 'source ~/.cpprc \
2221 && task build'
2322
23+
2424# ## Running environment
2525# use a distroless image or ubuntu:22.04 if you wish
26- FROM gcr.io/distroless/cc
26+ FROM gcr.io/distroless/cc as runner
2727# copy the built binaries and their runtime dependencies
2828COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
2929WORKDIR /home/app/
Original file line number Diff line number Diff line change 1- FROM ubuntu:20.04 AS base
1+ FROM ubuntu:20.04 as base
22
33# set time-zone
44ENV TZ=Canada/Pacific
@@ -8,7 +8,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
88ENV DEBIAN_FRONTEND=noninteractive
99RUN apt-get update -qq
1010RUN apt-get install -y --no-install-recommends curl gnupg ca-certificates
11- RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
11+ RUN [ "/bin/bash" , "-c" , "set -o pipefail && curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -" ]
1212RUN apt-get install -y --no-install-recommends nodejs
1313
1414# add setup-cpp.js
@@ -18,19 +18,21 @@ WORKDIR "/"
1818# run installation
1919RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
2020
21- CMD source ~/.cpprc
22- ENTRYPOINT [ "/bin/bash" ]
21+ CMD ["source" , "~/.cpprc" ]
22+ ENTRYPOINT ["/bin/bash" ]
23+
2324
2425# ### Building
25- FROM base AS builder
26- ADD ./dev/cpp_vcpkg_project /home/app
26+ FROM base as builder
27+ COPY ./dev/cpp_vcpkg_project /home/app
2728WORKDIR /home/app
2829RUN bash -c 'source ~/.cpprc \
2930 && task build'
3031
32+
3133# ## Running environment
3234# use a distroless image or ubuntu:20.04 if you wish
33- FROM gcr.io/distroless/cc
35+ FROM gcr.io/distroless/cc as runner
3436# copy the built binaries and their runtime dependencies
3537COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3638WORKDIR /home/app/
Original file line number Diff line number Diff line change @@ -10,23 +10,21 @@ WORKDIR "/"
1010# run installation
1111RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
1212
13- # clean up
14- RUN apt-get clean && rm -rf /var/lib/apt/lists/*
15- RUN rm -rf /tmp/*
16-
17- CMD source ~/.cpprc
13+ CMD ["source" , "~/.cpprc" ]
1814ENTRYPOINT [ "/bin/bash" ]
1915
16+
2017# ### Building
2118FROM base AS builder
2219COPY ./dev/cpp_vcpkg_project /home/app
2320WORKDIR /home/app
2421RUN bash -c 'source ~/.cpprc \
2522 && task build'
2623
24+
2725# ## Running environment
2826# use a distroless image or ubuntu:22.04 if you wish
29- FROM gcr.io/distroless/cc
27+ FROM gcr.io/distroless/cc as runner
3028# copy the built binaries and their runtime dependencies
3129COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3230WORKDIR /home/app/
You can’t perform that action at this time.
0 commit comments