From 6fa1bd422e5f7de28a8c02a43db6a84e50149b6f Mon Sep 17 00:00:00 2001 From: Jack Murdock Date: Fri, 30 Nov 2018 11:14:09 -0800 Subject: [PATCH] adds docker capabilities (#61) * adding docker capabilities * clean up .docker/ and simplify docker build * adding docker build to travis build * adding Dockerfile.local for faster local development --- .travis.yml | 1 + Dockerfile | 24 +++++++++++++++++ Dockerfile.local | 21 +++++++++++++++ example-talaria.yaml | 61 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 Dockerfile create mode 100644 Dockerfile.local create mode 100644 example-talaria.yaml diff --git a/.travis.yml b/.travis.yml index 3ebd560e..28551f63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ after_success: - docker cp build:/versionno.txt . - BINARY_NAME=`ls x86_64/` - TRAVIS_TAG=`cat versionno.txt` + - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then docker build -t talaria:local .; fi' deploy: provider: releases diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..387fe4b2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM golang:alpine as builder +MAINTAINER Jack Murdock + +# build the binary +WORKDIR /go/src +RUN apk add --update --repository https://dl-3.alpinelinux.org/alpine/edge/testing/ git curl +RUN curl https://glide.sh/get | sh +COPY src/ /go/src/ + +RUN glide -q install --strip-vendor +RUN go build -o talaria_linux_amd64 talaria + +EXPOSE 6200 6201 6202 +RUN mkdir -p /etc/talaria +VOLUME /etc/talaria + +# the actual image +FROM alpine:latest +RUN apk --no-cache add ca-certificates +RUN mkdir -p /etc/talaria +VOLUME /etc/talaria +WORKDIR /root/ +COPY --from=builder /go/src/talaria_linux_amd64 . +ENTRYPOINT ["./talaria_linux_amd64"] diff --git a/Dockerfile.local b/Dockerfile.local new file mode 100644 index 00000000..ca381ab0 --- /dev/null +++ b/Dockerfile.local @@ -0,0 +1,21 @@ +FROM golang:alpine as builder +MAINTAINER Jack Murdock + +# build the binary +WORKDIR /go/src +COPY src/ /go/src/ + +RUN go build -o talaria_linux_amd64 talaria + +EXPOSE 6200 6201 6202 +RUN mkdir -p /etc/talaria +VOLUME /etc/talaria + +# the actual image +FROM alpine:latest +RUN apk --no-cache add ca-certificates +RUN mkdir -p /etc/talaria +VOLUME /etc/talaria +WORKDIR /root/ +COPY --from=builder /go/src/talaria_linux_amd64 . +ENTRYPOINT ["./talaria_linux_amd64"] diff --git a/example-talaria.yaml b/example-talaria.yaml new file mode 100644 index 00000000..2a65eb3f --- /dev/null +++ b/example-talaria.yaml @@ -0,0 +1,61 @@ +--- + fqdn: talaria + env: test + scheme: http + + primary: + address: ":6200" + health: + address: ":6201" + pprof: + address: ":6202" + control: + address: ":6203" + metric: + address: ":6404" + metricsOptions: + namespace: "xmidt" + subsystem: "talaria" + + log: + file: "stdout" + level: "DEBUG" + json: false + + device: + manager: + upgrader: + handshakeTimeout: "10s" + initialCapacity: 100000 + maxDevices: 100 + deviceMessageQueueSize: 100 + pingPeriod: "45s" + idlePeriod: "135s" + requestTimeout: "15s" + outbound: + method: "POST" + eventEndpoints: + default: http://caduceus:6000/api/v3/notify + requestTimeout: "125s" + defaultScheme: "https" + allowedSchemes: + - "http" + - "https" + outboundQueueSize: 1000 + workerPoolSize: 100 + transport: + maxIdleConns: 0 + maxIdleConnsPerHost: 100 + idleConnTimeout: "120s" + clientTimeout: "160s" + authKey: YXV0aEhlYWRlcg== + inbound: + authKey: YXV0aEhlYWRlcg== + + eventMap: + default: http://caduceus:6000/api/v3/notify + + service: + defaultScheme: http + fixed: + - http://talaria:6200