Skip to content

Commit

Permalink
neat cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
feuyeux committed Oct 3, 2024
1 parent 5606aad commit ea77bc7
Show file tree
Hide file tree
Showing 64 changed files with 399 additions and 1,695 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,9 @@ updates:
interval: "daily"
- package-ecosystem: "pub"
directory: "hello_grpc_flutter"
schedule:
interval: "daily"
- package-ecosystem: "bazel"
directory: "hello-grpc-cpp"
schedule:
interval: "daily"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ docker/glog
docker/gflags
docker/Catch2
bazel-*
hello_grpc_flutter/build/*
.clwb

# flutter
hello_grpc_flutter/build/*
# kotlin
hello-grpc-kotlin/client/build
hello-grpc-kotlin/server/build
hello-grpc-kotlin/stub/build
hello-grpc-kotlin/protos/build

Binary file modified diagram/build_tools.zip
Binary file not shown.
Binary file modified diagram/operation_system_logo.zip
Binary file not shown.
Binary file modified diagram/program_language_logo.zip
Binary file not shown.
1 change: 0 additions & 1 deletion docker/build_cpp.sh

This file was deleted.

33 changes: 0 additions & 33 deletions docker/build_cpp_bazel.sh

This file was deleted.

42 changes: 0 additions & 42 deletions docker/build_cpp_cmake.sh

This file was deleted.

44 changes: 0 additions & 44 deletions docker/build_cpp_get_src.sh

This file was deleted.

27 changes: 27 additions & 0 deletions docker/cpp_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
cd "$(
cd "$(dirname "$0")" >/dev/null 2>&1
pwd -P
)/" || exit
# https://github.com/npclaudiu/grpc-cpp-docker.git

set -e
docker images | grep debian
cd ..
rm -rf docker/hello-grpc-cpp
cd hello-grpc-cpp
bazel clean
cd ..
cp -r hello-grpc-cpp docker/
cd docker
echo "1 build builder"
# --progress=plain
docker build -f cpp_grpc.dockerfile --target build -t feuyeux/grpc_cpp:1.0.0 .
# docker run --rm -it --entrypoint=bash feuyeux/grpc_cpp:1.0.0
echo "2 build server"
docker build -f cpp_grpc.dockerfile --target server -t feuyeux/grpc_server_cpp:1.0.0 .
echo "3 build client"
docker build -f cpp_grpc.dockerfile --target client -t feuyeux/grpc_client_cpp:1.0.0 .
rm -rf hello-grpc-cpp
echo "DONE"
# docker run --rm -it --entrypoint=bash feuyeux/grpc_server_cpp:1.0.0
12 changes: 8 additions & 4 deletions docker/grpc-cpp-bazel.dockerfile → docker/cpp_grpc.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,26 @@ RUN apt-get update && apt-get install -y \
&& apt-get clean

COPY bazel-7.0.2-installer-linux-x86_64.sh /source/bazel-installer.sh
COPY hello-grpc-cpp-bazel /source/hello-grpc-cpp-bazel
COPY hello-grpc-cpp /source/hello-grpc-cpp
WORKDIR /source
RUN chmod +x bazel-installer.sh && ./bazel-installer.sh && export PATH="$PATH:$/source/bin"
RUN cd hello-grpc-cpp-bazel && bazel build //:hello_server //:hello_client
WORKDIR /source/hello-grpc-cpp
RUN bazel build --jobs=8 //protos:hello_cc_grpc
RUN bazel build --jobs=8 //common:hello_utils
RUN bazel build --jobs=8 //common:hello_conn
RUN bazel build --jobs=8 //:hello_server //:hello_client

FROM debian:12-slim AS server
WORKDIR /opt/hello-grpc/
COPY --from=build /source/hello-grpc-cpp-bazel/bazel-bin/hello_server .
COPY --from=build /source/hello-grpc-cpp/bazel-bin/hello_server .
COPY tls/server_certs /var/hello_grpc/server_certs
COPY tls/client_certs /var/hello_grpc/client_certs
RUN /sbin/ldconfig -v
CMD ["./hello_server"]

FROM debian:12-slim AS client
WORKDIR /opt/hello-grpc/
COPY --from=build /source/hello-grpc-cpp-bazel/bazel-bin/hello_client .
COPY --from=build /source/hello-grpc-cpp/bazel-bin/hello_client .
COPY tls/client_certs /var/hello_grpc/client_certs
RUN /sbin/ldconfig -v
CMD ["./hello_client"]
3 changes: 3 additions & 0 deletions docker/cpp_push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
docker push feuyeux/grpc_server_cpp:1.0.0
docker push feuyeux/grpc_client_cpp:1.0.0
13 changes: 13 additions & 0 deletions docker/cpp_run_client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
cd "$(
cd "$(dirname "$0")" >/dev/null 2>&1
pwd -P
)/" || exit
export CLIENT_NAME=grpc_client_cpp
export CLIENT_IMG=feuyeux/$CLIENT_NAME:1.0.0
# if there's first argument, it's secure, otherwise insecure
if [ "$1" = "secure" ]; then
sh run_tls_client.sh
else
sh run_insecure_client.sh
fi
13 changes: 13 additions & 0 deletions docker/cpp_run_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
cd "$(
cd "$(dirname "$0")" >/dev/null 2>&1
pwd -P
)/" || exit
export SERVER_NAME=grpc_server_cpp
export SERVER_IMG=feuyeux/$SERVER_NAME:1.0.0
# if there's first argument, it's secure, otherwise insecure
if [ "$1" = "secure" ]; then
sh run_tls_server.sh
else
sh run_insecure_server.sh
fi
94 changes: 0 additions & 94 deletions gen_code/gen_code.sh.md

This file was deleted.

53 changes: 0 additions & 53 deletions gen_code/protos/landing.proto

This file was deleted.

Loading

0 comments on commit ea77bc7

Please sign in to comment.