ADD: added docker file

This commit is contained in:
Henry Winkel
2023-08-11 14:03:14 +02:00
parent bbf4be8108
commit 1b64d4e322
2 changed files with 58 additions and 4 deletions

42
Dockerfile Normal file
View File

@@ -0,0 +1,42 @@
#build with sudo buildah bud -t gateway:latest .
# Get the base Ubuntu image from Docker Hub
FROM debian:stable
RUN chown -R _apt /var/lib/apt
# Update apps on the base image
RUN apt-get update
RUN apt-get upgrade
# Install the Clang compiler
# RUN apt-get -y install
# install all used libs
RUN apt-get -y install libsodium23 libuuid1 libstdc++5 libcurl4
# copy all custom buld libs
COPY build/libs/EntityLibrary/libs/SimCore/libs/whisper-com/libs/libzmq/lib/libzmq.so.5 /usr/lib/
# COPY build/libs/EntityLibrary/libs/SimCore/libs/whisper-com/libs/protobuf/libprotobuf.so.32 /usr/lib/
COPY build/libs/EntityLibrary/libs/SimCore/libs/whisper-com/libs/protobuf/libprotobufd.so.32 /usr/lib/
COPY build/libs/EntityLibrary/libs/SimCore/libs/geographiclib/src/libGeographicLib.so.23 /usr/lib/
COPY build/libs/EntityLibrary/libs/KubeControl/libs/yaml-cpp/libyaml-cpp.so.0.7 /usr/lib/
COPY build/libs/EntityLibrary/libs/KubeControl/libs/curlpp/libcurlpp.so.1 /usr/lib/
# COPY build/libs/EntityLibrary/libs/SimCore/libs/crossguid/libcrossguid.so.0 /usr/lib/
COPY build/libs/EntityLibrary/libs/SimCore/libs/crossguid/libcrossguid-dgb.so.0 /usr/lib/
# Copy the current folder which contains C++ source code to the Docker image under /usr/src
COPY build/docs/config /usr/local/bin/docs/
COPY build/SimControlApplication /usr/local/bin/
# # Specify the working directory
WORKDIR /usr/local/bin/
# # Use Clang to compile the Test.cpp source file
# RUN clang++ -o Test Test.cpp
# Run the output program from the previous step
CMD ["SimControlApplication"]
# CMD ["bin/bash"]

View File

@@ -33,6 +33,8 @@ namespace SimControl {
SimControl::~SimControl()
{
this->stopMainThread_ = true;
TCPClient_ = nullptr;
@@ -41,6 +43,7 @@ namespace SimControl {
void SimControl::stop()
{
PodController_->stopAllPods();
this->stopMainThread_ = true;
TCPClient_.reset();
@@ -56,6 +59,8 @@ namespace SimControl {
{
LOG_S(INFO)<< "own ship data received";
auto OwnShipPos = std::make_shared<SimCore::Position>(simtrack->getPosition());
LOG_S(INFO)<< "Name: " << simtrack->Name.getValue() ;
LOG_S(INFO)<< " pos: Lat= "<< OwnShipPos->getGeodesicPos().x() << "Lon= "<< OwnShipPos->getGeodesicPos().y();
}
std::this_thread::sleep_for(std::chrono::milliseconds(500));
@@ -67,8 +72,9 @@ namespace SimControl {
void SimControl::MainFunction_()
{
kubecontrol::KubePod ShipPod1("hamburg","ship1","ship:latest");
// std::string uuid = xg::newGuid().str();
std::string uuid = "ship1";
kubecontrol::KubePod ShipPod1("hamburg",uuid,"ship:latest");
ShipPod1.setEnvironmentVar("ENTITY_ID", "ship1");
ShipPod1.setEnvironmentVar("ENTITY_NAME", "hamburg");
ShipPod1.setEnvironmentVar("POS_LAT", "\"55\"");
@@ -78,10 +84,16 @@ namespace SimControl {
ShipPod1.setEnvironmentVar("COMMAND_PORT", "\"5555\"");
ShipPod1.createYAML();
PodController_->startPod(ShipPod1);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
LOG_S(INFO)<<PodController_->getInfoForPod("hamburg");
// LOG_S(INFO)<<PodController_->getPodsInfo();
Orders::MoveOrder order(this->ID_,WHISPER::SourceType::SIMCOMTROLER);
order.Speed.setValue(5.14444);
Orders::MoveOrder order(this->ID_);
order.Speed.setValue(0);
TCPClient_->sendMessage(order.buildMessage().serialize());