diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index a3cc56b..8575eb3 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -19,10 +19,6 @@ jobs: choco install llvm curl -L -o boost.zip https://storage.cmr.dev.br/boost.zip unzip boost.zip -d boost - - os: fedora-latest - install: sudo dnf install -y clang boost-devel - - os: centos-latest - install: sudo yum install -y clang boost-devel steps: - name: Checkout code diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9c43c7f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:latest as cmr_cache + +USER root + +RUN apt update -y && \ + apt upgrade -y && \ + apt install -y libboost-all-dev clang && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/cmr-cache/ + +COPY . /tmp/build-cmr-cache/ + +RUN cd /tmp/build-cmr-cache/ && \ + clang++ -o cmr_cache main.cpp -I./vendor/yaml -I/usr/include/boost -L/usr/lib/x86_64-linux-gnu -lboost_system -lpthread -std=c++17 && \ + cp cmr_cache /usr/cmr-cache/ && \ + cp -r config/ /usr/cmr-cache/ && \ + rm -rf /tmp/build-cmr-cache/ + +ENTRYPOINT [ "./cmr_cache" ] diff --git a/core/entities/config.h b/core/entities/config.h index 5a81b78..edc3978 100644 --- a/core/entities/config.h +++ b/core/entities/config.h @@ -70,12 +70,14 @@ Yaml::Node& authIPs = auth["allow-ip"]; - if (authIPs.IsSequence() == false){ - throw std::runtime_error("ERROR: allow-ip is not a sequence in config/connect.yaml"); - } - - for (auto aIP = authIPs.Begin(); aIP != authIPs.End(); aIP++){ - config_connect.auth.allow_ip.push_back((*aIP).second.As()); + if (!authIPs.IsNone()){ + if (authIPs.IsSequence() == false){ + throw std::runtime_error("ERROR: allow-ip is not a sequence in config/connect.yaml"); + } + + for (auto aIP = authIPs.Begin(); aIP != authIPs.End(); aIP++){ + config_connect.auth.allow_ip.push_back((*aIP).second.As()); + } } Yaml::Node& basicAuth = auth["basic"]; diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ac67ae0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3" + +services: + cache: + container_name: cmr-cache + restart: always + build: + context: . + dockerfile: Dockerfile + ports: + - "6347:6347" + volumes: + - cmr-cache-data:/usr/cmr-cache/data/ + + +volumes: + cmr-cache-data: + driver: local \ No newline at end of file