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
162
162
FROM ubuntu:22.04 AS base
163
163
164
164
# add setup-cpp
165
- WORKDIR "/"
166
165
RUN 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
170
168
171
169
# 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
173
171
174
172
CMD source ~/.cpprc
175
173
ENTRYPOINT [ "/bin/bash" ]
Original file line number Diff line number Diff line change @@ -17,23 +17,21 @@ WORKDIR "/"
17
17
# run installation
18
18
RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
19
19
20
- # clean up
21
- RUN pacman -Scc --noconfirm
22
- RUN rm -rf /tmp/*
20
+ CMD ["source" , "~/.cpprc" ]
21
+ ENTRYPOINT ["/bin/bash" ]
23
22
24
- CMD source ~/.cpprc
25
- ENTRYPOINT [ "/bin/bash" ]
26
23
27
24
# ### Building
28
- FROM base AS builder
25
+ FROM base as builder
29
26
COPY ./dev/cpp_vcpkg_project /home/app
30
27
WORKDIR /home/app
31
28
RUN bash -c 'source ~/.cpprc \
32
29
&& task build'
33
30
31
+
34
32
# ## Running environment
35
33
# 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
37
35
# copy the built binaries and their runtime dependencies
38
36
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
39
37
WORKDIR /home/app/
Original file line number Diff line number Diff line change 1
1
# # base image
2
2
FROM fedora as base
3
3
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
9
6
10
7
# add setup-cpp.js
11
8
COPY "./dist/node12" "/"
@@ -14,22 +11,21 @@ WORKDIR "/"
14
11
# run installation
15
12
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
16
13
17
- # clean up
18
- RUN rm -rf /tmp/*
19
-
20
- CMD source ~/.cpprc
14
+ CMD ["source" , "~/.cpprc" ]
21
15
ENTRYPOINT [ "/bin/bash" ]
22
16
17
+
23
18
# ### Building
24
- FROM base AS builder
19
+ FROM base as builder
25
20
COPY ./dev/cpp_vcpkg_project /home/app
26
21
WORKDIR /home/app
27
22
RUN bash -c 'source ~/.cpprc \
28
23
&& task build'
29
24
25
+
30
26
# ## Running environment
31
27
# 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
33
29
# copy the built binaries and their runtime dependencies
34
30
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
35
31
WORKDIR /home/app/
Original file line number Diff line number Diff line change 1
1
# ### Base Image
2
- FROM ubuntu:22.04 AS base
2
+ FROM ubuntu:22.04 as base
3
3
4
- # add setup-cpp
5
- WORKDIR "/"
4
+ # install setup-cpp
6
5
RUN 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
10
8
11
9
# 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" ]
13
14
14
- CMD source ~/.cpprc
15
- ENTRYPOINT [ "/bin/bash" ]
16
15
17
16
# ### 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
20
19
WORKDIR /home/app
21
20
RUN bash -c 'source ~/.cpprc \
22
21
&& task build'
23
22
23
+
24
24
# ## Running environment
25
25
# 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
27
27
# copy the built binaries and their runtime dependencies
28
28
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
29
29
WORKDIR /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
2
2
3
3
# set time-zone
4
4
ENV TZ=Canada/Pacific
@@ -8,7 +8,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
8
8
ENV DEBIAN_FRONTEND=noninteractive
9
9
RUN apt-get update -qq
10
10
RUN 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 -" ]
12
12
RUN apt-get install -y --no-install-recommends nodejs
13
13
14
14
# add setup-cpp.js
@@ -18,19 +18,21 @@ WORKDIR "/"
18
18
# run installation
19
19
RUN node ./setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
20
20
21
- CMD source ~/.cpprc
22
- ENTRYPOINT [ "/bin/bash" ]
21
+ CMD ["source" , "~/.cpprc" ]
22
+ ENTRYPOINT ["/bin/bash" ]
23
+
23
24
24
25
# ### 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
27
28
WORKDIR /home/app
28
29
RUN bash -c 'source ~/.cpprc \
29
30
&& task build'
30
31
32
+
31
33
# ## Running environment
32
34
# 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
34
36
# copy the built binaries and their runtime dependencies
35
37
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
36
38
WORKDIR /home/app/
Original file line number Diff line number Diff line change @@ -10,23 +10,21 @@ WORKDIR "/"
10
10
# run installation
11
11
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
12
12
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" ]
18
14
ENTRYPOINT [ "/bin/bash" ]
19
15
16
+
20
17
# ### Building
21
18
FROM base AS builder
22
19
COPY ./dev/cpp_vcpkg_project /home/app
23
20
WORKDIR /home/app
24
21
RUN bash -c 'source ~/.cpprc \
25
22
&& task build'
26
23
24
+
27
25
# ## Running environment
28
26
# 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
30
28
# copy the built binaries and their runtime dependencies
31
29
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
32
30
WORKDIR /home/app/
You can’t perform that action at this time.
0 commit comments