Skip to content

Commit bdef4ad

Browse files
committed
docs: update the docker image in the readme [skip ci]
1 parent 3a3a6ae commit bdef4ad

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

README.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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
159158
RUN 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 setup-cpp@v0.30.1 && \
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

166185
ENTRYPOINT ["/bin/bash"]
167186

168187
#### Building (example)
169-
FROM base as builder
188+
FROM setup-cpp-ubuntu AS builder
189+
170190
COPY ./dev/cpp_vcpkg_project /home/app
171191
WORKDIR /home/app
172192
RUN 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
180200
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
181201
WORKDIR /home/app/
@@ -189,7 +209,7 @@ If you want to build the ones included, then run:
189209
```shell
190210
git clone --recurse-submodules https://github.com/aminya/setup-cpp
191211
cd ./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

195215
Where you should use the path to the dockerfile after `-f`.

0 commit comments

Comments
 (0)