From d9f54c3ad4a481cf14d08f8ae7d56074ea68a0bd Mon Sep 17 00:00:00 2001 From: geek Date: Fri, 13 Apr 2018 16:51:51 +0900 Subject: [PATCH] ing --- Dockerfile | 23 +++++++++++++++++++++++ _docker/bin/docker-entrypoint.sh | 4 ++++ _docker/config/config.json | 29 +++++++++++++++++++++++++++++ build.sh | 8 ++++++++ docker-compose.yml | 11 +++++++++++ 5 files changed, 75 insertions(+) create mode 100644 Dockerfile create mode 100644 _docker/bin/docker-entrypoint.sh create mode 100644 _docker/config/config.json create mode 100755 build.sh create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c7b688c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM alpine:3.7 + +# grab su-exec for easy step-down from root +RUN apk add --no-cache curl + +COPY _docker/config/* /etc/overflow/config/ +COPY _docker/bin/* /usr/local/overflow/bin/ +COPY dist/probe_gateway_rpc /usr/local/overflow/bin/ + +RUN mkdir -p /etc/overflow/config; \ + mkdir -p /usr/local/overflow/bin; \ + mkdir -p /var/overflow/logs; \ + chmod +x /usr/local/overflow/bin/docker-entrypoint.sh /usr/local/overflow/bin/probe_gateway_rpc; + +ENV TINI_VERSION='0.17.0' + +# Use tini as subreaper in Docker container to adopt zombie processes +RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini + +EXPOSE 80 + +ENTRYPOINT ["/bin/tini", "--"] +CMD ["/usr/local/overflow/bin/docker-entrypoint.sh"] \ No newline at end of file diff --git a/_docker/bin/docker-entrypoint.sh b/_docker/bin/docker-entrypoint.sh new file mode 100644 index 0000000..ec5919e --- /dev/null +++ b/_docker/bin/docker-entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +exec /usr/local/overflow/bin/probe_gateway_rpc -config-dir=/etc/overflow/config \ No newline at end of file diff --git a/_docker/config/config.json b/_docker/config/config.json new file mode 100644 index 0000000..751621f --- /dev/null +++ b/_docker/config/config.json @@ -0,0 +1,29 @@ +{ + "serverHandler": { + "name": "Gateway Probe", + "network": "tcp4", + "address": ":80", + "concurrency": 262144, + "keepAlive": 60, + "handshakeTimeout": 60, + "maxMessageSize": 8192, + "readBufferSize": 4096, + "writeBufferSize": 4096, + "readTimeout": 0, + "writeTimeout": 0, + "pongTimeout": 60, + "pingTimeout": 10, + "pingPeriod": 9, + "enableCompression": false + }, + "external": { + "grpc": { + "network": "tcp4", + "address": "192.168.1.50:50006" + }, + "redis": { + "network": "tcp4", + "address": "192.168.1.50:6379" + } + } +} diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..d1c77e4 --- /dev/null +++ b/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +rm ./dist +CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags="-s" -o ./dist/probe_gateway_rpc + +docker build -t docker.loafle.net/overflow/probe_gateway_rpc:1.0.0 . + +docker push docker.loafle.net/overflow/probe_gateway_rpc:1.0.0 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8ae2144 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3" + +services: + probe_gateway_rpc: + image: docker.loafle.net/overflow/probe_gateway_rpc:1.0.0 + container_name: probe_gateway_rpc + # volumes: + # - /service/redis/data/var/redis:/data + # - /service/redis/data/usr/local/etc/redis/redis.conf:/usr/local/etc/redis/redis.conf + ports: + - "19091:80" \ No newline at end of file