forked from thorgate/tg-hammer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-master
57 lines (42 loc) · 2.05 KB
/
Dockerfile-master
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
# Dockerfile for master machine
FROM python:2.7.13
############## Install system requirements #################
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y 'deb http://ppa.launchpad.net/mercurial-ppa/releases/ubuntu xenial main'
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y --no-install-recommends sudo g++ build-essential git mercurial python-dev openssh-server
RUN rm -rf /var/lib/apt/lists/*
############## Add SSH keys #################
COPY ./tests/ssh /root/.ssh
RUN chmod 700 -R /root/.ssh
RUN grep -q -F 'RSAAuthentication yes' /etc/ssh/sshd_config || echo 'RSAAuthentication yes' >> /etc/ssh/sshd_config
RUN grep -q -F 'PubkeyAuthentication yes' /etc/ssh/sshd_config || echo 'PubkeyAuthentication yes' >> /etc/ssh/sshd_config
RUN grep -q -F 'StrictHostKeyChecking no' /etc/ssh/ssh_config || echo 'StrictHostKeyChecking no' >> /etc/ssh/ssh_config
RUN grep -q -F 'NoHostAuthenticationForLocalhost yes' /etc/ssh/ssh_config || echo 'NoHostAuthenticationForLocalhost yes' >> /etc/ssh/ssh_config
RUN echo `cat /root/.ssh/test_key.pub` >> /root/.ssh/authorized_keys
RUN echo "Host hammer.repo.host" >> /root/.ssh/config
RUN echo " IdentityFile /root/.ssh/test_key" >> /root/.ssh/config
RUN echo " User root" >> /root/.ssh/config
RUN echo "Host staging.hammer" >> /root/.ssh/config
RUN echo " IdentityFile /root/.ssh/test_key" >> /root/.ssh/config
############## Make repo directories #################
RUN mkdir -p /repos/
RUN mkdir -p /repos/git
RUN mkdir -p /repos/hg
RUN chmod 777 /repos/git
RUN chmod 777 /repos/hg
######### Add requirements ###########
ADD ./requirements /hammer/requirements
RUN pip install -r /hammer/requirements/development.txt
######### Copy source files ###########
ADD . /hammer
######### Install requirements ###########
WORKDIR /hammer
# Remove old package egg
RUN rm -rf tg_hammer.egg-info
# Add current dir to installed packages
RUN ./setup.py develop
# Remove compiled python files
RUN find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf