mirror of
https://github.com/valitydev/registrator.git
synced 2024-11-06 02:45:17 +00:00
Merge multistage build and go dep usage (Gopkg.toml) (#6)
Use rbkmoney/embedded-base image
This commit is contained in:
parent
adbb1cc483
commit
6a2bcc045a
28
Dockerfile
28
Dockerfile
@ -1,13 +1,17 @@
|
||||
FROM gliderlabs/alpine:edge
|
||||
ENTRYPOINT ["/bin/registrator"]
|
||||
|
||||
FROM alpine:3.7 AS builder
|
||||
COPY . /go/src/github.com/gliderlabs/registrator
|
||||
RUN apk-install -t build-deps build-base go git mercurial \
|
||||
&& export GOPATH=/go \
|
||||
&& cd /go/src/github.com/gliderlabs/registrator \
|
||||
&& go get -v ./... \
|
||||
&& go get github.com/stretchr/testify/assert \
|
||||
&& go test -v ./... \
|
||||
&& go build -ldflags "-X main.Version=$(cat VERSION)" -o /bin/registrator \
|
||||
&& rm -rf /go \
|
||||
&& apk del --purge build-deps
|
||||
RUN export GOPATH="/go" PATH="${PATH}:/go/bin" \
|
||||
&& apk --no-cache add -t build-deps build-base go git curl \
|
||||
&& apk --no-cache add ca-certificates \
|
||||
&& mkdir -p /go/bin \
|
||||
&& curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||
RUN export GOPATH="/go" PATH="${PATH}:/go/bin" \
|
||||
&& cd /go/src/github.com/gliderlabs/registrator \
|
||||
&& git config --global http.https://gopkg.in.followRedirects true \
|
||||
&& dep ensure \
|
||||
&& go build -v -ldflags "-X main.Version=$(cat VERSION)" -o /bin/registrator
|
||||
|
||||
FROM dr.rbkmoney.com/rbkmoney/embedded-base:6edae32c882e63735af15b5e37c2bca0c5918484
|
||||
COPY --from=builder /bin/registrator /bin/registrator
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
ENTRYPOINT ["/bin/registrator"]
|
||||
|
@ -1,9 +0,0 @@
|
||||
FROM gliderlabs/alpine:3.3
|
||||
CMD ["/bin/registrator"]
|
||||
|
||||
ENV GOPATH /go
|
||||
RUN apk-install build-base go git mercurial
|
||||
COPY . /go/src/github.com/gliderlabs/registrator
|
||||
RUN cd /go/src/github.com/gliderlabs/registrator \
|
||||
&& go get \
|
||||
&& go build -ldflags "-X main.Version=dev" -o /bin/registrator
|
201
Gopkg.lock
generated
Normal file
201
Gopkg.lock
generated
Normal file
@ -0,0 +1,201 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/Azure/go-ansiterm"
|
||||
packages = [
|
||||
".",
|
||||
"winterm"
|
||||
]
|
||||
revision = "d6e3b3328b783f23731bc4d058875b0371ff8109"
|
||||
[[projects]]
|
||||
name = "github.com/Microsoft/go-winio"
|
||||
packages = ["."]
|
||||
revision = "7da180ee92d8bd8bb8c37fc560e673e6557c392f"
|
||||
version = "v0.4.7"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/Nvveen/Gotty"
|
||||
packages = ["."]
|
||||
revision = "cd527374f1e5bff4938207604a14f2e38a9cf512"
|
||||
[[projects]]
|
||||
name = "github.com/cenkalti/backoff"
|
||||
packages = ["."]
|
||||
revision = "2ea60e5f094469f9e65adb9cd103795b73ae743e"
|
||||
version = "v2.0.0"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/containerd/continuity"
|
||||
packages = ["pathdriver"]
|
||||
revision = "c6cef34830231743494fe2969284df7b82cc0ad0"
|
||||
[[projects]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
[[projects]]
|
||||
name = "github.com/docker/docker"
|
||||
packages = [
|
||||
"api/types",
|
||||
"api/types/blkiodev",
|
||||
"api/types/container",
|
||||
"api/types/filters",
|
||||
"api/types/mount",
|
||||
"api/types/network",
|
||||
"api/types/registry",
|
||||
"api/types/strslice",
|
||||
"api/types/swarm",
|
||||
"api/types/swarm/runtime",
|
||||
"api/types/versions",
|
||||
"opts",
|
||||
"pkg/archive",
|
||||
"pkg/fileutils",
|
||||
"pkg/homedir",
|
||||
"pkg/idtools",
|
||||
"pkg/ioutils",
|
||||
"pkg/jsonmessage",
|
||||
"pkg/longpath",
|
||||
"pkg/mount",
|
||||
"pkg/pools",
|
||||
"pkg/stdcopy",
|
||||
"pkg/system",
|
||||
"pkg/term",
|
||||
"pkg/term/windows"
|
||||
]
|
||||
revision = "a422774e593b33bd287d9890544ad9e09b380d8c"
|
||||
[[projects]]
|
||||
name = "github.com/docker/go-connections"
|
||||
packages = ["nat"]
|
||||
revision = "3ede32e2033de7505e6500d6c868c2b9ed9f169d"
|
||||
version = "v0.3.0"
|
||||
[[projects]]
|
||||
name = "github.com/docker/go-units"
|
||||
packages = ["."]
|
||||
revision = "47565b4f722fb6ceae66b95f853feed578a4a51c"
|
||||
version = "v0.3.3"
|
||||
[[projects]]
|
||||
name = "github.com/fsouza/go-dockerclient"
|
||||
packages = ["."]
|
||||
revision = "ca33ff277b527ce11b793e62f9ba244129b01caf"
|
||||
version = "v1.2.0"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/gliderlabs/pkg"
|
||||
packages = ["usage"]
|
||||
revision = "36f28d47ec7aae4d25d3d2741ac5af91f7f18680"
|
||||
[[projects]]
|
||||
name = "github.com/gogo/protobuf"
|
||||
packages = ["proto"]
|
||||
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
|
||||
version = "v1.0.0"
|
||||
[[projects]]
|
||||
name = "github.com/hashicorp/consul"
|
||||
packages = ["api"]
|
||||
revision = "fb848fc48818f58690db09d14640513aa6bf3c02"
|
||||
version = "v1.0.7"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/go-cleanhttp"
|
||||
packages = ["."]
|
||||
revision = "d5fe4b57a186c716b0e00b8c301cbd9b4182694d"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/go-rootcerts"
|
||||
packages = ["."]
|
||||
revision = "6bb64b370b90e7ef1fa532be9e591a81c3493e00"
|
||||
[[projects]]
|
||||
name = "github.com/hashicorp/serf"
|
||||
packages = ["coordinate"]
|
||||
revision = "d6574a5bb1226678d7010325fb6c985db20ee458"
|
||||
version = "v0.8.1"
|
||||
[[projects]]
|
||||
name = "github.com/miekg/dns"
|
||||
packages = ["."]
|
||||
revision = "83c435cc65d2862736428b9b4d07d0ab10ad3e4d"
|
||||
version = "v1.0.5"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/mitchellh/go-homedir"
|
||||
packages = ["."]
|
||||
revision = "b8bc1bf767474819792c23f32d8286a45736f1c6"
|
||||
[[projects]]
|
||||
name = "github.com/opencontainers/go-digest"
|
||||
packages = ["."]
|
||||
revision = "279bed98673dd5bef374d3b6e4b09e2af76183bf"
|
||||
version = "v1.0.0-rc1"
|
||||
[[projects]]
|
||||
name = "github.com/opencontainers/image-spec"
|
||||
packages = [
|
||||
"specs-go",
|
||||
"specs-go/v1"
|
||||
]
|
||||
revision = "d60099175f88c47cd379c4738d158884749ed235"
|
||||
version = "v1.0.1"
|
||||
[[projects]]
|
||||
name = "github.com/opencontainers/runc"
|
||||
packages = [
|
||||
"libcontainer/system",
|
||||
"libcontainer/user"
|
||||
]
|
||||
revision = "baf6536d6259209c3edfa2b22237af82942d3dfa"
|
||||
version = "v0.1.1"
|
||||
[[projects]]
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
||||
version = "v0.8.0"
|
||||
[[projects]]
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/samuel/go-zookeeper"
|
||||
packages = ["zk"]
|
||||
revision = "c4fab1ac1bec58281ad0667dc3f0907a9476ac47"
|
||||
[[projects]]
|
||||
name = "github.com/sirupsen/logrus"
|
||||
packages = ["."]
|
||||
revision = "c155da19408a8799da419ed3eeb0cb5db0ad5dbc"
|
||||
version = "v1.0.5"
|
||||
[[projects]]
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert"]
|
||||
revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
|
||||
version = "v1.2.1"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = [
|
||||
"ed25519",
|
||||
"ed25519/internal/edwards25519",
|
||||
"ssh/terminal"
|
||||
]
|
||||
revision = "e73bf333ef8920dbb52ad18d4bd38ad9d9bc76d7"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"bpf",
|
||||
"context",
|
||||
"context/ctxhttp",
|
||||
"internal/iana",
|
||||
"internal/socket",
|
||||
"ipv4",
|
||||
"ipv6"
|
||||
]
|
||||
revision = "5f9ae10d9af5b1c89ae6904293b14b064d4ada23"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = [
|
||||
"unix",
|
||||
"windows"
|
||||
]
|
||||
revision = "79b0c6888797020a994db17c8510466c72fe75d9"
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "cda685c394db30d7f3d3c76aa470320ba13d83a37c6c53fec0e58dd0566321f4"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
33
Gopkg.toml
Normal file
33
Gopkg.toml
Normal file
@ -0,0 +1,33 @@
|
||||
[[constraint]]
|
||||
name = "github.com/cenkalti/backoff"
|
||||
version = "2.0.0"
|
||||
[[constraint]]
|
||||
name = "github.com/fsouza/go-dockerclient"
|
||||
version = "1.2.0"
|
||||
[[override]]
|
||||
name = "github.com/docker/docker"
|
||||
revision = "a422774e593b33bd287d9890544ad9e09b380d8c"
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/gliderlabs/pkg"
|
||||
[[constraint]]
|
||||
name = "github.com/hashicorp/consul"
|
||||
version = "1.0.7"
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/go-cleanhttp"
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/samuel/go-zookeeper"
|
||||
[[constraint]]
|
||||
name = "github.com/stretchr/testify"
|
||||
version = "1.2.1"
|
||||
# [[constraint]]
|
||||
# name = "gopkg.in/coreos/go-etcd.v0"
|
||||
# version = "0.4.6"
|
||||
# [[constraint]]
|
||||
# name = "github.com/coreos/go-etcd"
|
||||
# version = "2.0.0"
|
||||
[prune]
|
||||
go-tests = true
|
||||
unused-packages = true
|
14
Makefile
14
Makefile
@ -1,12 +1,7 @@
|
||||
NAME=registrator
|
||||
VERSION=$(shell cat VERSION)
|
||||
DEV_RUN_OPTS ?= consul:
|
||||
|
||||
dev:
|
||||
docker build -f Dockerfile.dev -t $(NAME):dev .
|
||||
docker run --rm \
|
||||
-v /var/run/docker.sock:/tmp/docker.sock \
|
||||
$(NAME):dev /bin/registrator $(DEV_RUN_OPTS)
|
||||
.PHONY: build release docs
|
||||
|
||||
build:
|
||||
mkdir -p build
|
||||
@ -19,15 +14,8 @@ release:
|
||||
cp build/* release
|
||||
gh-release create gliderlabs/$(NAME) $(VERSION) \
|
||||
$(shell git rev-parse --abbrev-ref HEAD) $(VERSION)
|
||||
glu hubtag gliderlabs/$(NAME) $(VERSION)
|
||||
|
||||
docs:
|
||||
boot2docker ssh "sync; sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'" || true
|
||||
docker run --rm -it -p 8000:8000 -v $(PWD):/work gliderlabs/pagebuilder mkdocs serve
|
||||
|
||||
circleci:
|
||||
rm -f ~/.gitconfig
|
||||
go get -u github.com/gliderlabs/glu
|
||||
glu circleci
|
||||
|
||||
.PHONY: build release docs
|
||||
|
@ -34,7 +34,7 @@ hostname (`-h $HOSTNAME`) and using the `-ip` Registrator option below.
|
||||
Option | Since | Description
|
||||
------ | ----- | -----------
|
||||
`-cleanup` | v7 | Cleanup dangling services
|
||||
`-deregister <mode>` | v6 | Deregister existed services "always" or "on-success". Default: always
|
||||
`-deregister <mode>` | v6 | Deregister exited services "always" or "on-success". Default: always
|
||||
`-internal` | | Use exposed ports instead of published ports
|
||||
`-ip <ip address>` | | Force IP address used for registering services
|
||||
`-resync <seconds>` | v6 | Frequency all services are resynchronized. Default: 0, never
|
||||
|
Loading…
Reference in New Issue
Block a user