Skip to content

Commit e982b85

Browse files
committed
docs: update the readme docker [skip ci]
1 parent acb5fbf commit e982b85

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ jobs:
179179
Here is an example for using setup_cpp to make a builder image that has the Cpp tools you need.
180180

181181
```dockerfile
182-
FROM ubuntu:devel
182+
#### Base Image
183+
FROM ubuntu:devel AS base
183184

184185
# add setup_cpp
185186
WORKDIR "/"
@@ -189,12 +190,25 @@ RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.
189190
RUN chmod +x ./setup_cpp_linux
190191

191192
# install llvm, cmake, ninja, and ccache
192-
RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true
193-
194-
# activate cpp environment variables
195-
RUN source ~/.cpprc
193+
RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --make true
196194

195+
CMD source ~/.cpprc
197196
ENTRYPOINT [ "/bin/bash" ]
197+
198+
#### Building
199+
FROM base AS builder
200+
ADD ./dev/cpp_vcpkg_project /home/app
201+
WORKDIR /home/app
202+
RUN bash -c 'source ~/.cpprc \
203+
&& make build'
204+
205+
### Running environment
206+
# use a distroless image or ubuntu:devel if you wish
207+
FROM gcr.io/distroless/cc
208+
# copy the built binaries and their runtime dependencies
209+
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
210+
WORKDIR /home/app/
211+
ENTRYPOINT ["./my_exe"]
198212
```
199213

200214
See [this folder](https://github.com/aminya/setup-cpp/tree/master/dev/docker), for some dockerfile examples.

dev/docker/ubuntu.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ RUN bash -c 'source ~/.cpprc \
2222
&& make build'
2323

2424
### Running environment
25+
# use a distroless image or ubuntu:devel if you wish
2526
FROM gcr.io/distroless/cc
2627
# copy the built binaries and their runtime dependencies
2728
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/

dev/docker/ubuntu_node.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ RUN bash -c 'source ~/.cpprc \
2121
&& make build'
2222

2323
### Running environment
24+
# use a distroless image or ubuntu:devel if you wish
2425
FROM gcr.io/distroless/cc
2526
# copy the built binaries and their runtime dependencies
2627
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/

dev/docker/ubuntu_stable_node.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ RUN bash -c 'source ~/.cpprc \
2929
&& make build'
3030

3131
### Running environment
32+
# use a distroless image or ubuntu:20.04 if you wish
3233
FROM gcr.io/distroless/cc
3334
# copy the built binaries and their runtime dependencies
3435
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/

0 commit comments

Comments
 (0)