1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00
awx/installer/roles/image_build/templates/Dockerfile.j2

152 lines
3.8 KiB
Django/Jinja

FROM centos:7
USER root
ADD ansible.repo /etc/yum.repos.d/ansible.repo
ADD RPM-GPG-KEY-ansible-release /etc/pki/rpm-gpg/RPM-GPG-KEY-ansible-release
# add rhscl repo for rh-postgresql-devel
RUN yum -y install centos-release-scl
RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
RUN yum -y update && yum -y install epel-release && yum -y install https://centos7.iuscommunity.org/ius-release.rpm
# sync with tools/docker-compose/Dockerfile
RUN yum -y install acl \
ansible \
bubblewrap \
curl \
cyrus-sasl \
cyrus-sasl-devel \
gcc \
gcc-c++ \
git2u \
git2u-core \
krb5-devel \
krb5-libs \
krb5-workstation \
libcurl-devel \
libffi-devel \
libselinux-python \
libstdc++.so.6 \
libtool-ltdl-devel \
libxml2-devel \
libxslt-devel \
make \
mercurial \
mg \
nginx \
nodejs \
openldap-devel \
openssh-server \
rh-postgresql10-postgresql-devel \
rh-postgresql10-postgresql-server-syspaths \
scl-utils-build \
scl-utils \
python-devel \
python-pip \
python-psutil \
python-psycopg2 \
python-setuptools \
python36-devel \
python36-setuptools \
rsync \
setools-libs \
subversion \
sudo \
swig \
tmux \
unzip \
vim \
xmlsec1 \
xmlsec1-devel \
xmlsec1-openssl \
xmlsec1-openssl-devel \
yum-utils
ADD https://github.com/krallin/tini/releases/download/v0.14.0/tini /tini
RUN chmod +x /tini
RUN python3 -m ensurepip && pip3 install virtualenv
RUN pip install supervisor
RUN find / -name pg_config
ADD Makefile /tmp/Makefile
RUN mkdir /tmp/requirements
ADD requirements/requirements_ansible.txt \
requirements/requirements_ansible_uninstall.txt \
requirements/requirements_ansible_git.txt \
requirements/requirements.txt \
requirements/requirements_tower_uninstall.txt \
requirements/requirements_git.txt \
/tmp/requirements/
RUN scl enable rh-postgresql10 'cd /tmp && VENV_BASE="/var/lib/awx/venv" make requirements'
RUN yum -y remove cyrus-sasl-devel \
gcc \
gcc-c++ \
krb5-devel \
libtool-ltdl-devel \
libxml2-devel \
libxslt-devel \
openldap-devel \
rh-postgresql10-postgresql-devel \
python-devel \
python36-devel \
nodejs \
xmlsec1-devel \
xmlsec1-openssl-devel
# makes postgres available for data migrations when upgrading
RUN export PATH=/usr/pgsql-10/bin:$PATH
RUN yum -y clean all
RUN rm -rf /root/.cache
RUN localedef -c -i en_US -f UTF-8 en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN ln -s /var/lib/awx/venv/awx/bin/awx-manage /usr/bin/awx-manage
RUN rm -rf /tmp/*
RUN echo "{{ awx_version }}" > /var/lib/awx/.tower_version
COPY {{ awx_sdist_file }} /tmp/{{ awx_sdist_file }}
RUN OFFICIAL=yes /var/lib/awx/venv/awx/bin/pip install /tmp/{{ awx_sdist_file }}
ADD settings.py /etc/tower/settings.py
ADD nginx.conf /etc/nginx/nginx.conf
ADD supervisor.conf /supervisor.conf
ADD supervisor_task.conf /supervisor_task.conf
ADD launch_awx.sh /usr/bin/launch_awx.sh
ADD launch_awx_task.sh /usr/bin/launch_awx_task.sh
ADD config-watcher /usr/bin/config-watcher
RUN chmod +rx /usr/bin/launch_awx.sh && \
chmod +rx /usr/bin/launch_awx_task.sh && \
chmod +rx /usr/bin/config-watcher
RUN find /var/lib/awx -not -path '/var/lib/awx/venv*' | xargs chgrp root
RUN find /var/lib/awx -not -path '/var/lib/awx/venv*' | xargs chmod g+w
# Pre-create things that we need to write to
RUN for dir in /home/awx /var/log/tower /var/log/nginx /var/lib/nginx; \
do mkdir -p $dir; chmod -R g+rwx $dir; chgrp -R root $dir; done
RUN for file in /etc/passwd /var/run/nginx.pid; \
do touch $file; chmod -R g+rwx $file; chgrp -R root $file; done
VOLUME /var/lib/nginx
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
ENV HOME=/home/awx
WORKDIR ${HOME}
USER 1000
EXPOSE 8052
ENTRYPOINT ["/tini", "--"]
CMD /usr/bin/launch_awx.sh