-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
88 lines (72 loc) · 2.74 KB
/
Dockerfile
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
#-----------------------------------------------------------------------
# Control-M/Agent in a docker container in user-defined network
# The docker host is an AWS Linux machine
#-----------------------------------------------------------------------
FROM centos:7
ARG CTMHOST
ARG CTMENV
USER root
# install python
RUN yum -y install python3 python-pip python-urllib3
# install basic packages
RUN yum -y update \
&& yum -y install wget \
&& yum -y install unzip \
&& yum -y install sudo \
&& yum -y install net-tools \
&& yum -y install psmisc \
&& yum -y install socat
# install nodejs
RUN curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - \
&& yum -y install nodejs \
&& node -v \
&& npm -v
# install java 8
RUN yum -y install java-1.8.0-openjdk \
&& java -version
# install ctm-automation-api kit
WORKDIR /root
RUN mkdir ctm-automation-api \
&& cd ctm-automation-api \
&& wget --no-check-certificate https://$CTMHOST:8443/automation-api/ctm-cli.tgz \
&& npm install -g ctm-cli.tgz \
&& ctm -v
# add ec2-user user and root to soduers list
RUN useradd -d /home/ec2-user -p ec2-user -m ec2-user \
&& echo 'root ALL=(ALL) ALL' >> /etc/sudoers \
&& echo 'ec2-user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Extract Control-M Environment definition for the specified CTMENV
# and add to current user
USER ec2-user
WORKDIR /home/ec2-user
# Copy secrets from Docker build context - If running in a Swarm, use Docker secrets management or any desired vault
# and create a default environment with the secret info
RUN mkdir /tmp/.ctm
COPY $CTMENV/*.secret /home/ec2-user/
#RUN ctm env add ${CTMENV} `cat endpoint.secret` `cat username.secret` `cat password.secret`
RUN ctm environment workbench::add `cat endpoint.secret`
RUN ctm env set ${CTMENV}
# provision controlm agent image
RUN cd \
&& ctm session login -e ${CTMENV} \
&& ctm provision image Agent.Linux
# enable controlm agent utilities
RUN echo "source /home/ec2-user/.bash_profile" >> /home/ec2-user/.bashrc
# copy run and register Control-M agent script to container
COPY run_register_controlm.sh /tmp
COPY decommission_controlm.sh /tmp
RUN cp /tmp/run_register_controlm.sh /home/ec2-user \
&& cp /tmp/decommission_controlm.sh /home/ec2-user \
&& chmod +x run_register_controlm.sh \
&& chmod +x decommission_controlm.sh
# copy sample job flow to container
COPY pythonimage/requirements.txt /home/ec2-user/
RUN pip3 install --user --no-cache-dir -r /home/ec2-user/requirements.txt
# FIXME put on separate volume - for now
COPY pythonimage/runJob.py /home/ec2-user/
COPY pythonimage/srv01-job.yaml /home/ec2-user/
COPY pythonimage/srv02-job.yaml /home/ec2-user/
#COPY MultiContainerSampleFlow.json /home/ec2-user/
EXPOSE 7000-8000
EXPOSE 22
CMD ["/home/ec2-user/run_register_controlm.sh"]