docs: update the readme docker [skip ci]

This commit is contained in:
Amin Yahyaabadi 2022-04-26 23:05:25 -07:00
parent acb5fbf162
commit e982b8598f
4 changed files with 22 additions and 5 deletions

View File

@ -179,7 +179,8 @@ jobs:
Here is an example for using setup_cpp to make a builder image that has the Cpp tools you need. Here is an example for using setup_cpp to make a builder image that has the Cpp tools you need.
```dockerfile ```dockerfile
FROM ubuntu:devel #### Base Image
FROM ubuntu:devel AS base
# add setup_cpp # add setup_cpp
WORKDIR "/" WORKDIR "/"
@ -189,12 +190,25 @@ RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.
RUN chmod +x ./setup_cpp_linux RUN chmod +x ./setup_cpp_linux
# install llvm, cmake, ninja, and ccache # install llvm, cmake, ninja, and ccache
RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true RUN ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --make true
# activate cpp environment variables
RUN source ~/.cpprc
CMD source ~/.cpprc
ENTRYPOINT [ "/bin/bash" ] ENTRYPOINT [ "/bin/bash" ]
#### Building
FROM base AS builder
ADD ./dev/cpp_vcpkg_project /home/app
WORKDIR /home/app
RUN bash -c 'source ~/.cpprc \
&& make build'
### Running environment
# use a distroless image or ubuntu:devel if you wish
FROM gcr.io/distroless/cc
# copy the built binaries and their runtime dependencies
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/
WORKDIR /home/app/
ENTRYPOINT ["./my_exe"]
``` ```
See [this folder](https://github.com/aminya/setup-cpp/tree/master/dev/docker), for some dockerfile examples. See [this folder](https://github.com/aminya/setup-cpp/tree/master/dev/docker), for some dockerfile examples.

View File

@ -22,6 +22,7 @@ RUN bash -c 'source ~/.cpprc \
&& make build' && make build'
### Running environment ### Running environment
# use a distroless image or ubuntu:devel if you wish
FROM gcr.io/distroless/cc FROM gcr.io/distroless/cc
# copy the built binaries and their runtime dependencies # copy the built binaries and their runtime dependencies
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/ COPY --from=builder /home/app/build/my_exe/Release/ /home/app/

View File

@ -21,6 +21,7 @@ RUN bash -c 'source ~/.cpprc \
&& make build' && make build'
### Running environment ### Running environment
# use a distroless image or ubuntu:devel if you wish
FROM gcr.io/distroless/cc FROM gcr.io/distroless/cc
# copy the built binaries and their runtime dependencies # copy the built binaries and their runtime dependencies
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/ COPY --from=builder /home/app/build/my_exe/Release/ /home/app/

View File

@ -29,6 +29,7 @@ RUN bash -c 'source ~/.cpprc \
&& make build' && make build'
### Running environment ### Running environment
# use a distroless image or ubuntu:20.04 if you wish
FROM gcr.io/distroless/cc FROM gcr.io/distroless/cc
# copy the built binaries and their runtime dependencies # copy the built binaries and their runtime dependencies
COPY --from=builder /home/app/build/my_exe/Release/ /home/app/ COPY --from=builder /home/app/build/my_exe/Release/ /home/app/