Skip to content

Commit a0b095e

Browse files
authored
Merge pull request #161 from abeimler/fix/docker-new-setup-cpp-npm [skip ci]
2 parents 995537c + fb63167 commit a0b095e

File tree

6 files changed

+40
-48
lines changed

6 files changed

+40
-48
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,12 @@ Here is an example for using setup-cpp to make a builder image that has the Cpp
162162
FROM ubuntu:22.04 AS base
163163

164164
# add setup-cpp
165-
WORKDIR "/"
166165
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
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

174172
CMD source ~/.cpprc
175173
ENTRYPOINT [ "/bin/bash" ]

dev/docker/arch_node.dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,21 @@ WORKDIR "/"
1717
# run installation
1818
RUN 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
2926
COPY ./dev/cpp_vcpkg_project /home/app
3027
WORKDIR /home/app
3128
RUN 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
3836
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3937
WORKDIR /home/app/

dev/docker/fedora_node.dockerfile

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
## base image
22
FROM 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
118
COPY "./dist/node12" "/"
@@ -14,22 +11,21 @@ WORKDIR "/"
1411
# run installation
1512
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
1613

17-
# clean up
18-
RUN rm -rf /tmp/*
19-
20-
CMD source ~/.cpprc
14+
CMD ["source", "~/.cpprc"]
2115
ENTRYPOINT [ "/bin/bash" ]
2216

17+
2318
#### Building
24-
FROM base AS builder
19+
FROM base as builder
2520
COPY ./dev/cpp_vcpkg_project /home/app
2621
WORKDIR /home/app
2722
RUN 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
3430
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3531
WORKDIR /home/app/

dev/docker/ubuntu.dockerfile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
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
65
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
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
2019
WORKDIR /home/app
2120
RUN 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
2828
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
2929
WORKDIR /home/app/

dev/docker/ubuntu_20.04_node.dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:20.04 AS base
1+
FROM ubuntu:20.04 as base
22

33
# set time-zone
44
ENV TZ=Canada/Pacific
@@ -8,7 +8,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
88
ENV DEBIAN_FRONTEND=noninteractive
99
RUN apt-get update -qq
1010
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 -"]
1212
RUN apt-get install -y --no-install-recommends nodejs
1313

1414
# add setup-cpp.js
@@ -18,19 +18,21 @@ WORKDIR "/"
1818
# run installation
1919
RUN 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
2728
WORKDIR /home/app
2829
RUN 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
3537
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3638
WORKDIR /home/app/

dev/docker/ubuntu_node.dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,21 @@ WORKDIR "/"
1010
# run installation
1111
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
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"]
1814
ENTRYPOINT [ "/bin/bash" ]
1915

16+
2017
#### Building
2118
FROM base AS builder
2219
COPY ./dev/cpp_vcpkg_project /home/app
2320
WORKDIR /home/app
2421
RUN 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
3129
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
3230
WORKDIR /home/app/

0 commit comments

Comments
 (0)