fix: docker files
This commit is contained in:
parent
d1a7730a16
commit
4515977620
6 changed files with 46 additions and 17 deletions
39
Dockerfile
39
Dockerfile
|
@ -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
|
||||
|
||||
|
@ -8,9 +36,6 @@ WORKDIR $CORE_ROOT
|
|||
|
||||
RUN ./build.sh
|
||||
|
||||
FROM drogonframework/drogon-arm
|
||||
|
||||
COPY --from=installer /bin/core /bin/core
|
||||
|
||||
WORKDIR /srv/core
|
||||
EXPOSE 5000
|
||||
ENTRYPOINT ["core"]
|
||||
ENTRYPOINT ["./core"]
|
||||
|
|
3
build.sh
3
build.sh
|
@ -31,5 +31,6 @@ fi
|
|||
|
||||
cp core /bin/
|
||||
|
||||
mkdir /srv/core
|
||||
mkdir /srv/core/
|
||||
cp config.json /srv/core
|
||||
cp core /srv/core/
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
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 = 4419;
|
||||
int discover_timeout_ms = 2000;
|
||||
uint16_t discover_timeout_ms = 2000;
|
||||
uint8_t discover_code_accept = 0;
|
||||
uint8_t discover_code_reject = 100;
|
||||
|
||||
|
|
6
config.h
6
config.h
|
@ -5,10 +5,12 @@
|
|||
|
||||
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;
|
||||
extern int discover_timeout_ms;
|
||||
extern uint16_t discover_timeout_ms;
|
||||
extern uint8_t discover_code_accept;
|
||||
extern uint8_t discover_code_reject;
|
||||
|
||||
|
|
|
@ -2,11 +2,6 @@ version: '3.2'
|
|||
volumes:
|
||||
v-core-data:
|
||||
services:
|
||||
drogon-arm:
|
||||
image: drogonframework/drogon-arm
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.drogon
|
||||
core:
|
||||
image: registry.gitlab.com/emgauwa/core
|
||||
build:
|
||||
|
|
4
main.cc
4
main.cc
|
@ -5,6 +5,7 @@
|
|||
#include <csignal>
|
||||
|
||||
#include "globals.h"
|
||||
#include "config.h"
|
||||
|
||||
static void
|
||||
terminate(int signum)
|
||||
|
@ -45,6 +46,9 @@ main()
|
|||
//drogon::app().getLoop()->runEvery(1, &test);
|
||||
|
||||
//Run HTTP framework,the method will block in the internal event loop
|
||||
|
||||
LOG_INFO << "Starting Emgauwa Core (" << config::version << ")";
|
||||
|
||||
drogon::app().run();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue