@@ -153,29 +153,49 @@ Here is an example for using setup-cpp to make a builder image that has the Cpp
153153
154154``` dockerfile
155155# ### Base Image
156- FROM ubuntu:22.04 as base
156+ FROM ubuntu:22.04 as setup-cpp-ubuntu
157157
158- # install nodejs and setup-cpp
159158RUN apt-get update -qq && \
159+ # install nodejs
160160 apt-get install -y --no-install-recommends nodejs npm && \
161- npm install -g setup-cpp
162-
163- # install llvm, cmake, ninja, and ccache
164- RUN setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true
161+ # install setup-cpp
162+ npm install -g
[email protected] && \
163+ # install the compiler and tools
164+ setup-cpp \
165+ --nala true \
166+ --compiler llvm \
167+ --cmake true \
168+ --ninja true \
169+ --task true \
170+ --vcpkg true \
171+ --python true \
172+ --make true \
173+ --cppcheck true \
174+ --gcovr true \
175+ --doxygen true \
176+ --ccache true && \
177+ # cleanup
178+ nala autoremove -y && \
179+ nala autopurge -y && \
180+ apt-get clean && \
181+ nala clean --lists && \
182+ rm -rf /var/lib/apt/lists/* && \
183+ rm -rf /tmp/*
165184
166185ENTRYPOINT ["/bin/bash" ]
167186
168187# ### Building (example)
169- FROM base as builder
188+ FROM setup-cpp-ubuntu AS builder
189+
170190COPY ./dev/cpp_vcpkg_project /home/app
171191WORKDIR /home/app
172192RUN bash -c 'source ~/.cpprc \
173193 && task build'
174194
195+ # ### Running environment
196+ # use a fresh image as the runner
197+ FROM ubuntu:22.04 as runner
175198
176- # ## Running environment
177- # use a distroless image or ubuntu:22.04 if you wish
178- FROM gcr.io/distroless/cc as runner
179199# copy the built binaries and their runtime dependencies
180200COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
181201WORKDIR /home/app/
@@ -189,7 +209,7 @@ If you want to build the ones included, then run:
189209``` shell
190210git clone --recurse-submodules https://github.com/aminya/setup-cpp
191211cd ./setup-cpp
192- docker build -f ./dev/docker/ubuntu.dockerfile -t setup-cpp .
212+ docker build -f ./dev/docker/setup-cpp- ubuntu.dockerfile -t setup-cpp .
193213```
194214
195215Where you should use the path to the dockerfile after ` -f ` .
0 commit comments