-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile-master
More file actions
60 lines (45 loc) · 2.33 KB
/
Copy pathDockerfile-master
File metadata and controls
60 lines (45 loc) · 2.33 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
# Dockerfile for master machine
FROM python:[PYTHON_VERSION]
############## Install system requirements #################
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F59CE3A8323293EE
RUN add-apt-repository -y ppa:mercurial-ppa/releases/
RUN sed -i 's/focal/xenial/' /etc/apt/sources.list.d/mercurial-ppa-ubuntu-releases-focal.list || echo "not needed on py2"
RUN sed -i 's/jessie/wily/' /etc/apt/sources.list.d/mercurial-ppa-releases-jessie.list || echo "not needed on py3"
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/[DEPENDENCY_FILE].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