-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path02_kubernetes_mesos_framework
More file actions
88 lines (75 loc) · 3.17 KB
/
Copy path02_kubernetes_mesos_framework
File metadata and controls
88 lines (75 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#
# Dockerfile - Apache Mesos Framework (kubernetes-mesos)
#
# - Build
# docker build --rm -t k8sm:framework -f 02_kubernetes_mesos_framework .
#
# - Run
# docker run -d --name="kubernetes-mesos" -h "kubernetes-mesos" --privileged=true -v /dev:/dev k8sm:framework
#
# - SSH
# ssh `docker inspect -f '{{ .NetworkSettings.IPAddress }}' kubernetes-mesos`
# Use the base images
FROM ubuntu:15.04
MAINTAINER Yongbok Kim <ruo91@yongbok.net>
# Change the repository
#RUN sed -i 's/archive.ubuntu.com/kr.archive.ubuntu.com/g' /etc/apt/sources.list
# The last update and install package for mesos
RUN apt-get update && apt-get install -y add-apt-key \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF \
&& echo "deb http://repos.mesosphere.io/ubuntu vivid main" > /etc/apt/sources.list.d/mesosphere.list \
&& apt-get update && apt-get install -y mesos openssh-server supervisor openssh-server nano curl git-core build-essential net-tools iputils-ping bridge-utils
# Variable
ENV SRC_DIR /opt
WORKDIR $SRC_DIR
# GO Language
ENV GO_ARCH linux-amd64
ENV GOROOT $SRC_DIR/go
ENV PATH $PATH:$GOROOT/bin
RUN curl -XGET https://github.com/golang/go/tags | grep tag-name > /tmp/golang_tag \
&& sed -e 's/<[^>]*>//g' /tmp/golang_tag > /tmp/golang_ver \
&& GO_VER=`sed -e 's/ go/go/g' /tmp/golang_ver | head -n 1` && rm -f /tmp/golang_* \
&& curl -LO "https://storage.googleapis.com/golang/$GO_VER.$GO_ARCH.tar.gz" \
&& tar -C $SRC_DIR -xzf go*.tar.gz && rm -rf go*.tar.gz \
&& echo '' >> /etc/profile \
&& echo '# Golang' >> /etc/profile \
&& echo "export GOROOT=$GOROOT" >> /etc/profile \
&& echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/profile \
&& echo '' >> /etc/profile
# Flannel
ENV FLANNEL_HOME $SRC_DIR/flannel
ENV PATH $PATH:$FLANNEL_HOME/bin
RUN git clone https://github.com/coreos/flannel.git \
&& cd flannel && ./build \
&& echo '# flannel'>>/etc/profile \
&& echo "export FLANNEL_HOME=/opt/flannel">>/etc/profile \
&& echo 'export PATH=$PATH:$FLANNEL_HOME/bin'>>/etc/profile \
&& echo ''>>/etc/profile
# Google - Kubernetes
ENV KUBERNETES_HOME $SRC_DIR/kubernetes
ENV PATH $PATH:$KUBERNETES_HOME/server/bin
ADD kubernetes-server-linux-amd64.tar.gz $SRC_DIR
RUN echo '# Kubernetes' >> /etc/profile \
&& echo "export KUBERNETES_HOME=$KUBERNETES_HOME" >> /etc/profile \
&& echo 'export PATH=$PATH:$KUBERNETES_HOME/server/bin' >> /etc/profile \
&& echo '' >> /etc/profile
# Add the kubernetes & flannel scripts
ADD conf/network/flannel.sh /bin/flannel.sh
ADD conf/cluster/kubernetes/k8sm.sh /bin/k8sm.sh
ADD conf/cluster/kubernetes/mesos-clould.conf $SRC_DIR/mesos-clould.conf
ADD conf/cluster/kubernetes/k8sm_master_add_bridge.sh /bin/k8sm_master_add_bridge.sh
RUN chmod a+x /bin/flannel.sh /bin/k8sm.sh /bin/k8sm_master_add_bridge.sh
# Supervisor
RUN mkdir -p /var/log/supervisor
ADD conf/supervisord/00_default.conf /etc/supervisor/conf.d/supervisord.conf
# SSH
RUN mkdir /var/run/sshd
RUN sed -i 's/without-password/yes/g' /etc/ssh/sshd_config
RUN sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
RUN sed -i 's/\#AuthorizedKeysFile/AuthorizedKeysFile/g' /etc/ssh/sshd_config
# Set the root password for ssh
RUN echo 'root:k8sm' |chpasswd
# Port
EXPOSE 22 8080
# Daemon
CMD ["/usr/bin/supervisord"]