-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.centos
56 lines (45 loc) · 1.36 KB
/
Dockerfile.centos
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
FROM centos:7
ENV TERM linux
ENV LANG en_US.utf8
# Update CentOS
RUN yum repolist
RUN yum -y update
# Install dev tools
RUN yum -y install epel-release
RUN yum -y install git sudo vim curl bzip2-devel libffi-devel openssl11-devel zlib-devel
RUN yum -y groupinstall "Development Tools"
# Prepare OpenSSL 1.1 for Python build
RUN mkdir /usr/local/openssl11
WORKDIR /usr/local/openssl11
RUN ln -s /usr/lib64/openssl11 lib
RUN ln -s /usr/include/openssl11 include
# Download Python 3.10.9 source
WORKDIR /
RUN curl -s https://www.python.org/ftp/python/3.10.9/Python-3.10.9.tgz | tar xz
RUN chown -R root:root /Python-3.10.9
WORKDIR "/Python-3.10.9"
# Configure and build Python
RUN ./configure --enable-optimizations --with-openssl=/usr/local/openssl11
RUN make altinstall
# Clean up
WORKDIR /
RUN rm -rf /Python-3.10.9
# Install Ansible
RUN pip3.10 install ansible
# Create a non-root user, allow sudo
RUN groupadd test
RUN useradd -c "Test User" -g test -G wheel -s /bin/bash -m test
RUN mkdir -v /work
COPY . /work
RUN /usr/bin/find /work -type f -exec chmod 0644 {} \;
RUN chown -R test:test /work
RUN sed -i 's/ALL$/NOPASSWD:ALL/' /etc/sudoers
# Become non-root user
USER test
RUN sudo mv -v /work /home/test
WORKDIR /home/test/work
# Test the playbook
RUN ansible-galaxy install -r requirements.yml
RUN ansible-playbook -i localhost, btv.yml
WORKDIR /home/test
CMD ["/bin/bash"]