fix: docker files

This commit is contained in:
Tobias Reisinger 2019-08-22 21:38:23 +02:00
parent d1a7730a16
commit 4515977620
6 changed files with 46 additions and 17 deletions

View file

@ -1,6 +1,34 @@
FROM drogonframework/drogon-arm AS installer FROM ubuntu:18.04
ENV CORE_ROOT=$IROOT/core RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends software-properties-common \
sudo curl wget cmake locales git gcc-8 g++-8 \
openssl libssl-dev libjsoncpp-dev uuid-dev zlib1g-dev \
postgresql-server-dev-all libmariadbclient-dev libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/* \
&& locale-gen en_US.UTF-8 \
&& cd /opt/ \
&& wget -qO- https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/6.0.0/flyway-commandline-6.0.0-linux-x64.tar.gz | tar xvz \
&& sudo ln -s /opt/flyway-6.0.0/flyway /usr/local/bin
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
CC=gcc-8 \
CXX=g++-8 \
AR=gcc-ar-8 \
RANLIB=gcc-ranlib-8 \
IROOT=/install
ENV DROGON_ROOT=$IROOT/drogon \
CORE_ROOT=$IROOT/core
ADD https://api.github.com/repos/an-tao/drogon/git/refs/heads/master $IROOT/version.json
RUN git clone https://github.com/an-tao/drogon $DROGON_ROOT
WORKDIR $DROGON_ROOT
RUN ./build.sh
COPY . $CORE_ROOT COPY . $CORE_ROOT
@ -8,9 +36,6 @@ WORKDIR $CORE_ROOT
RUN ./build.sh RUN ./build.sh
FROM drogonframework/drogon-arm WORKDIR /srv/core
COPY --from=installer /bin/core /bin/core
EXPOSE 5000 EXPOSE 5000
ENTRYPOINT ["core"] ENTRYPOINT ["./core"]

View file

@ -31,5 +31,6 @@ fi
cp core /bin/ cp core /bin/
mkdir /srv/core mkdir /srv/core/
cp config.json /srv/core cp config.json /srv/core
cp core /srv/core/

View file

@ -2,10 +2,12 @@
namespace config namespace config
{ {
int discover_max_client_backlog = 20; char version[] = "0.0.1";
uint16_t discover_max_client_backlog = 20;
uint16_t discover_port_dev = 4420; uint16_t discover_port_dev = 4420;
uint16_t discover_port = 4419; uint16_t discover_port = 4419;
int discover_timeout_ms = 2000; uint16_t discover_timeout_ms = 2000;
uint8_t discover_code_accept = 0; uint8_t discover_code_accept = 0;
uint8_t discover_code_reject = 100; uint8_t discover_code_reject = 100;

View file

@ -5,10 +5,12 @@
namespace config namespace config
{ {
extern int discover_max_client_backlog; extern char version[];
extern uint16_t discover_max_client_backlog;
extern uint16_t discover_port_dev; extern uint16_t discover_port_dev;
extern uint16_t discover_port; extern uint16_t discover_port;
extern int discover_timeout_ms; extern uint16_t discover_timeout_ms;
extern uint8_t discover_code_accept; extern uint8_t discover_code_accept;
extern uint8_t discover_code_reject; extern uint8_t discover_code_reject;

View file

@ -2,11 +2,6 @@ version: '3.2'
volumes: volumes:
v-core-data: v-core-data:
services: services:
drogon-arm:
image: drogonframework/drogon-arm
build:
context: .
dockerfile: Dockerfile.drogon
core: core:
image: registry.gitlab.com/emgauwa/core image: registry.gitlab.com/emgauwa/core
build: build:

View file

@ -5,6 +5,7 @@
#include <csignal> #include <csignal>
#include "globals.h" #include "globals.h"
#include "config.h"
static void static void
terminate(int signum) terminate(int signum)
@ -45,6 +46,9 @@ main()
//drogon::app().getLoop()->runEvery(1, &test); //drogon::app().getLoop()->runEvery(1, &test);
//Run HTTP framework,the method will block in the internal event loop //Run HTTP framework,the method will block in the internal event loop
LOG_INFO << "Starting Emgauwa Core (" << config::version << ")";
drogon::app().run(); drogon::app().run();
return 0; return 0;
} }