agones.dev/agones@v1.53.0/examples/cpp-simple/Dockerfile (about) 1 # Copyright 2017 Google LLC All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 FROM debian:bookworm as builder 16 17 RUN apt-get update && apt-get install -y \ 18 build-essential autoconf libtool git pkg-config \ 19 automake libtool curl make g++ unzip moreutils cmake \ 20 && apt-get clean 21 22 WORKDIR /project 23 24 # Install gRPC and dependencies 25 RUN git clone --recurse-submodules -b v1.72.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc /var/local/git/grpc && \ 26 cd /var/local/git/grpc && \ 27 mkdir -p cmake/build && \ 28 cd cmake/build && \ 29 export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \ 30 cmake -DCMAKE_BUILD_TYPE=Release \ 31 -DgRPC_INSTALL=ON \ 32 -DgRPC_BUILD_TESTS=OFF ../.. && \ 33 make -j$(nproc) && make install 34 35 # Install Agones SDK 36 COPY ./sdks/cpp sdk 37 RUN cd sdk && \ 38 mkdir -p .build && \ 39 cd .build && \ 40 export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \ 41 cmake .. -DCMAKE_BUILD_TYPE=Release -DAGONES_SILENT_OUTPUT=OFF -DCMAKE_INSTALL_PREFIX=/project/sdk/.build \ 42 -G "Unix Makefiles" -Wno-dev && \ 43 cmake --build . --target install -j$(nproc) 44 45 # Build sample application 46 COPY ./examples/cpp-simple cpp-simple 47 RUN cd cpp-simple && mkdir -p .build && cd .build && \ 48 export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) && \ 49 cmake .. -G "Unix Makefiles" \ 50 -DCMAKE_BUILD_TYPE=Release \ 51 -DCMAKE_PREFIX_PATH=/project/sdk/.build \ 52 -Dagones_DIR=/project/sdk/.build/agones/cmake \ 53 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.bin && \ 54 cmake --build . --target install -j$(nproc) 55 56 FROM debian:bookworm 57 RUN useradd -u 1000 -m server 58 59 COPY --from=builder --chown=server:server /project/cpp-simple/.build/.bin/cpp-simple /home/server/cpp-simple 60 61 USER 1000 62 ENTRYPOINT /home/server/cpp-simple