Reduce the size of the production container image

This commit is contained in:
Matthew Jones 2017-08-22 09:02:32 -04:00
parent d39c70d9f2
commit 6e4d886ea4
No known key found for this signature in database
GPG Key ID: 76A4C17A97590C1C
3 changed files with 11 additions and 14 deletions

View File

@ -608,9 +608,3 @@ psql-container:
VERSION:
echo $(VERSION_TARGET) > $@
production-openshift-image: sdist
cat installer/openshift/Dockerfile | sed "s/{{ version }}/$(VERSION_TARGET)/g" | sed "s/{{ tar }}/$(SDIST_TAR_FILE)/g" > ./Dockerfile.production
cp installer/openshift/Dockerfile.celery ./Dockerfile.celery.production
docker build -t awx_web -f ./Dockerfile.production .
docker build -t awx_task -f ./Dockerfile.celery.production .

View File

@ -9,7 +9,6 @@
- name: Set global version if not provided
set_fact:
awx_version: "{{ awx_version_command.stdout }}"
use_local_awx: true
when: awx_version is not defined
- name: Set sdist file name
@ -26,7 +25,6 @@
chdir: ..
creates: "../dist/{{ awx_sdist_file }}"
delegate_to: localhost
when: use_local_awx is not defined
- name: Set docker build base path
set_fact:

View File

@ -23,15 +23,23 @@ ADD requirements/requirements_ansible.txt \
/tmp/requirements/
# OS Dependencies
RUN yum -y install epel-release && yum -y localinstall http://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm && yum -y update && yum -y install ansible git curl python-psycopg2 python-pip python-setuptools libselinux-python setools-libs yum-utils sudo acl make postgresql-devel nginx python-psutil libxml2-devel libxslt-devel libstdc++.so.6 gcc cyrus-sasl-devel cyrus-sasl openldap-devel libffi-devel python-pip xmlsec1-devel swig krb5-devel xmlsec1-openssl xmlsec1 xmlsec1-openssl-devel libtool-ltdl-devel bubblewrap gcc-c++ python-devel
RUN pip install virtualenv supervisor
WORKDIR /tmp
RUN mkdir -p /var/lib/awx/public/static
RUN chgrp -Rf root /var/lib/awx && chmod -Rf g+w /var/lib/awx
RUN yum -y install epel-release && \
yum -y localinstall http://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm && \
yum -y update && \
yum -y install ansible git curl python-psycopg2 python-pip python-setuptools libselinux-python setools-libs yum-utils sudo acl make postgresql-devel nginx python-psutil libxml2-devel libxslt-devel libstdc++.so.6 gcc cyrus-sasl-devel cyrus-sasl openldap-devel libffi-devel python-pip xmlsec1-devel swig krb5-devel xmlsec1-openssl xmlsec1 xmlsec1-openssl-devel libtool-ltdl-devel bubblewrap gcc-c++ python-devel && \
pip install virtualenv supervisor && \
VENV_BASE=/var/lib/awx/venv make requirements_ansible && \
VENV_BASE=/var/lib/awx/venv make requirements_awx && \
yum -y remove gcc postgresql-devel libxml2-devel libxslt-devel cyrus-sasl-devel openldap-devel xmlsec1-devel krb5-devel xmlsec1-openssl-devel libtool-ltdl-devel gcc-c++ python-devel && \
yum -y clean all && \
rm -rf /root/.cache
RUN mkdir -p /var/log/tower
RUN mkdir -p /etc/tower
RUN echo "awxsecret" > /etc/tower/SECRET_KEY
RUN VENV_BASE=/var/lib/awx/venv make requirements_ansible && VENV_BASE=/var/lib/awx/venv make requirements_awx
COPY {{ awx_sdist_file }} /tmp/{{ awx_sdist_file }}
RUN OFFICIAL=yes pip install /tmp/{{ awx_sdist_file }}
@ -43,10 +51,7 @@ ADD launch_awx.sh /usr/bin/launch_awx.sh
ADD launch_awx_task.sh /usr/bin/launch_awx_task.sh
RUN chmod +rx /usr/bin/launch_awx.sh && chmod +rx /usr/bin/launch_awx_task.sh
ADD settings.py /etc/tower/settings.py
RUN yum -y remove gcc postgresql-devel libxml2-devel libxslt-devel cyrus-sasl-devel openldap-devel xmlsec1-devel krb5-devel xmlsec1-openssl-devel libtool-ltdl-devel gcc-c++ python-devel && yum -y clean all
RUN rm -rf /root/.cache
RUN chmod g+w /etc/passwd
RUN chgrp -Rf root /var/lib/awx && chmod -Rf g+w /var/lib/awx
RUN chmod -R 777 /var/log/nginx && chmod -R 777 /var/lib/nginx
USER 1000
EXPOSE 8052