Dockerfile-test: make Go version flexible, move other test Dockerfiles

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyu-Ho Lee
2017-10-25 19:35:22 -07:00
parent 736b9f0be3
commit 70f64bb1b6
17 changed files with 97 additions and 39 deletions

View File

@ -0,0 +1,48 @@
FROM ubuntu:16.10
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get -y update \
&& apt-get -y install \
build-essential \
gcc \
apt-utils \
pkg-config \
software-properties-common \
apt-transport-https \
libssl-dev \
sudo \
bash \
curl \
tar \
git \
netcat \
bind9 \
dnsutils \
&& apt-get -y update \
&& apt-get -y upgrade \
&& apt-get -y autoremove \
&& apt-get -y autoclean
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH ${GOPATH}/bin:${GOROOT}/bin:${PATH}
ENV GO_VERSION REPLACE_ME_GO_VERSION
ENV GO_DOWNLOAD_URL https://storage.googleapis.com/golang
RUN rm -rf ${GOROOT} \
&& curl -s ${GO_DOWNLOAD_URL}/go${GO_VERSION}.linux-amd64.tar.gz | tar -v -C /usr/local/ -xz \
&& mkdir -p ${GOPATH}/src ${GOPATH}/bin \
&& go version
RUN mkdir -p /var/bind /etc/bind
RUN chown root:bind /var/bind /etc/bind
ADD Procfile /Procfile
ADD run.sh /run.sh
ADD named.conf etcd.zone rdns.zone /etc/bind/
RUN chown root:bind /etc/bind/named.conf /etc/bind/etcd.zone /etc/bind/rdns.zone
ADD resolv.conf /etc/resolv.conf
RUN go get github.com/mattn/goreman
CMD ["/run.sh"]

View File

@ -0,0 +1,5 @@
etcd1: ./etcd --name m1 --listen-client-urls https://127.0.0.1:2379 --advertise-client-urls https://m1.etcd.local:2379 --listen-peer-urls https://127.0.0.1:2380 --initial-advertise-peer-urls=https://m1.etcd.local:2380 --initial-cluster-token tkn --discovery-srv=etcd.local --initial-cluster-state new --peer-cert-file=/certs/server-wildcard.crt --peer-key-file=/certs/server-wildcard.key.insecure --peer-trusted-ca-file=/certs/ca.crt --peer-client-cert-auth --cert-file=/certs/server-wildcard.crt --key-file=/certs/server-wildcard.key.insecure --trusted-ca-file=/certs/ca.crt --client-cert-auth
etcd2: ./etcd --name m2 --listen-client-urls https://127.0.0.1:22379 --advertise-client-urls https://m2.etcd.local:22379 --listen-peer-urls https://127.0.0.1:22380 --initial-advertise-peer-urls=https://m2.etcd.local:22380 --initial-cluster-token tkn --discovery-srv=etcd.local --initial-cluster-state new --peer-cert-file=/certs/server-wildcard.crt --peer-key-file=/certs/server-wildcard.key.insecure --peer-trusted-ca-file=/certs/ca.crt --peer-client-cert-auth --cert-file=/certs/server-wildcard.crt --key-file=/certs/server-wildcard.key.insecure --trusted-ca-file=/certs/ca.crt --client-cert-auth
etcd3: ./etcd --name m3 --listen-client-urls https://127.0.0.1:32379 --advertise-client-urls https://m3.etcd.local:32379 --listen-peer-urls https://127.0.0.1:32380 --initial-advertise-peer-urls=https://m3.etcd.local:32380 --initial-cluster-token tkn --discovery-srv=etcd.local --initial-cluster-state new --peer-cert-file=/certs/server-wildcard.crt --peer-key-file=/certs/server-wildcard.key.insecure --peer-trusted-ca-file=/certs/ca.crt --peer-client-cert-auth --cert-file=/certs/server-wildcard.crt --key-file=/certs/server-wildcard.key.insecure --trusted-ca-file=/certs/ca.crt --client-cert-auth

View File

@ -0,0 +1,16 @@
etcd.local. IN SOA bindhostname. admin.etcd.local. (
1452607488
10800
3600
604800
38400 )
etcd.local. IN NS bindhostname.
m1.etcd.local. 300 IN A 127.0.0.1
m2.etcd.local. 300 IN A 127.0.0.1
m3.etcd.local. 300 IN A 127.0.0.1
_etcd-client-ssl._tcp 300 IN SRV 0 0 2379 m1.etcd.local.
_etcd-client-ssl._tcp 300 IN SRV 0 0 22379 m2.etcd.local.
_etcd-client-ssl._tcp 300 IN SRV 0 0 32379 m3.etcd.local.
_etcd-server-ssl._tcp 300 IN SRV 0 0 2380 m1.etcd.local.
_etcd-server-ssl._tcp 300 IN SRV 0 0 22380 m2.etcd.local.
_etcd-server-ssl._tcp 300 IN SRV 0 0 32380 m3.etcd.local.

View File

@ -0,0 +1,23 @@
options {
directory "/var/bind";
listen-on { 127.0.0.1; };
listen-on-v6 { none; };
allow-transfer {
none;
};
// If you have problems and are behind a firewall:
query-source address * port 53;
pid-file "/var/run/named/named.pid";
allow-recursion { none; };
recursion no;
};
zone "etcd.local" IN {
type master;
file "/etc/bind/etcd.zone";
};
zone "0.0.127.in-addr.arpa" {
type master;
file "/etc/bind/rdns.zone";
};

View File

@ -0,0 +1,13 @@
$TTL 86400
@ IN SOA etcdns.local. root.etcdns.local. (
100500 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
IN NS ns.etcdns.local.
IN A 127.0.0.1
1 IN PTR m1.etcd.local.
1 IN PTR m2.etcd.local.
1 IN PTR m3.etcd.local.

View File

@ -0,0 +1 @@
nameserver 127.0.0.1

View File

@ -0,0 +1,16 @@
#!/bin/sh
/etc/init.d/bind9 start
# get rid of hosts so go lookup won't resolve 127.0.0.1 to localhost
cat /dev/null >/etc/hosts
goreman -f /Procfile start &
sleep 7s
ETCDCTL_API=3 ./etcdctl \
--cacert=/certs/ca.crt \
--cert=/certs/server-wildcard.crt \
--key=/certs//server-wildcard.key.insecure \
--discovery-srv etcd.local \
put foo bar