[DEV-167] Create full docker-based environment for client team testing (#78)

* [DEV-167] Created Dockerfile, dockerignore, and docker-compose.

* [DEV-167] Updated docker-compose to use remote image.

* [DEV-167] Added --addrindex to docker-compose.

* [DEV-167] Switched to testnet and plugged in the correct address.

* [DEV-167] Removed the third and fourth nodes from docker-compose.

* [DEV-167] Exposed RPC port, added rpcuser and rpcpass.

* [DEV-167] Wrangled RPC stuff into shape. Moved docker stuff into btcd/docker.

* [DEV-167] Moved dockerignore back to root. Corrected path for rpc.cert and rpc.key.

* [DEV-167] Added Jenkins job stuff.

* [DEV-167] Added deploy.sh.

* [DEV-167] Removed .travis.yaml and a couple of files that shouldn't be in this branch.
This commit is contained in:
stasatdaglabs 2018-10-18 11:49:11 +03:00 committed by GitHub
parent 201d7e0207
commit d5787954ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 18 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
vendor/
**/docker-compose.yml

3
.gitignore vendored
View File

@ -38,3 +38,6 @@ _testmain.go
.vscode
debug
debug.test
# CI
version.txt

View File

@ -1,17 +0,0 @@
language: go
go:
- "1.9.5"
- "1.10.1"
sudo: false
install:
- GLIDE_TAG=v0.12.3
- GLIDE_DOWNLOAD="https://github.com/Masterminds/glide/releases/download/$GLIDE_TAG/glide-$GLIDE_TAG-linux-amd64.tar.gz"
- curl -L $GLIDE_DOWNLOAD | tar -xvz
- export PATH=$PATH:$PWD/linux-amd64/
- glide install
- go install . ./cmd/...
- go get -u gopkg.in/alecthomas/gometalinter.v2
- gometalinter.v2 --install
script:
- export PATH=$PATH:$HOME/gopath/bin
- ./goclean.sh

43
docker/Dockerfile Normal file
View File

@ -0,0 +1,43 @@
# -- multistage docker build: stage #1: build stage
FROM golang:1.10-alpine AS build
RUN mkdir -p /go/src/github.com/daglabs/btcd
WORKDIR /go/src/github.com/daglabs/btcd
RUN apk add --no-cache curl git openssh binutils gcc musl-dev
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
RUN go get -u github.com/golang/lint/golint \
github.com/kisielk/errcheck \
github.com/opennota/check/cmd/aligncheck \
github.com/opennota/check/cmd/structcheck \
github.com/opennota/check/cmd/varcheck
COPY ./Gopkg.* ./
RUN dep ensure -v --vendor-only
COPY . .
RUN gofmt -d -e -s . \
&& go tool vet -all . \
&& golint -set_exit_status . \
&& aligncheck . \
&& structcheck -e . \
&& varcheck -e .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o btcd .
RUN strip btcd
RUN go test ./...
# --- multistage docker build: stage #2: runtime image
FROM alpine
WORKDIR /app
RUN apk add --no-cache ca-certificates tini
COPY --from=build /go/src/github.com/daglabs/btcd/btcd /app/
COPY --from=build /go/src/github.com/daglabs/btcd/version.txt /app/
USER nobody
ENTRYPOINT [ "/sbin/tini", "--" ]

26
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,26 @@
version: '3'
services:
first:
image: 956501169541.dkr.ecr.us-east-1.amazonaws.com/btcd:latest
command: [
"btcd",
"--testnet",
"--addrindex",
"--generate",
"--miningaddr=dagtest:qrm4zaetvny2yuh4wudf8y43fd20lunkxs8quragg8",
"--rpcuser=user",
"--rpcpass=pass",
"--rpclisten=0.0.0.0:18334",
"--rpccert=docker/rpc.cert",
"--rpckey=docker/rpc.key"
]
ports: ["18334:18334"]
second:
image: 956501169541.dkr.ecr.us-east-1.amazonaws.com/btcd:latest
links: ["first"]
command: [
"btcd",
"--testnet",
"--addrindex",
"--connect=first"
]

17
docker/rpc.cert Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN CERTIFICATE-----
MIICxjCCAiegAwIBAgIRAPJqXxfYxt2SS4zBDePySIcwCgYIKoZIzj0EAwQwNDEg
MB4GA1UEChMXYnRjZCBhdXRvZ2VuZXJhdGVkIGNlcnQxEDAOBgNVBAMTB1N0YXMt
UEMwHhcNMTgxMDAzMDkyNjI4WhcNMjgxMDAxMDkyNjI4WjA0MSAwHgYDVQQKExdi
dGNkIG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