mirror of
https://github.com/ansible/awx.git
synced 2026-03-29 06:45:09 -02:30
Reduce the size of the production container image
This commit is contained in:
6
Makefile
6
Makefile
@@ -608,9 +608,3 @@ psql-container:
|
|||||||
VERSION:
|
VERSION:
|
||||||
echo $(VERSION_TARGET) > $@
|
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 .
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
- name: Set global version if not provided
|
- name: Set global version if not provided
|
||||||
set_fact:
|
set_fact:
|
||||||
awx_version: "{{ awx_version_command.stdout }}"
|
awx_version: "{{ awx_version_command.stdout }}"
|
||||||
use_local_awx: true
|
|
||||||
when: awx_version is not defined
|
when: awx_version is not defined
|
||||||
|
|
||||||
- name: Set sdist file name
|
- name: Set sdist file name
|
||||||
@@ -26,7 +25,6 @@
|
|||||||
chdir: ..
|
chdir: ..
|
||||||
creates: "../dist/{{ awx_sdist_file }}"
|
creates: "../dist/{{ awx_sdist_file }}"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
when: use_local_awx is not defined
|
|
||||||
|
|
||||||
- name: Set docker build base path
|
- name: Set docker build base path
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|||||||
@@ -23,15 +23,23 @@ ADD requirements/requirements_ansible.txt \
|
|||||||
/tmp/requirements/
|
/tmp/requirements/
|
||||||
|
|
||||||
# OS Dependencies
|
# 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
|
WORKDIR /tmp
|
||||||
RUN mkdir -p /var/lib/awx/public/static
|
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 /var/log/tower
|
||||||
RUN mkdir -p /etc/tower
|
RUN mkdir -p /etc/tower
|
||||||
RUN echo "awxsecret" > /etc/tower/SECRET_KEY
|
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 }}
|
COPY {{ awx_sdist_file }} /tmp/{{ awx_sdist_file }}
|
||||||
RUN OFFICIAL=yes pip install /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
|
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
|
RUN chmod +rx /usr/bin/launch_awx.sh && chmod +rx /usr/bin/launch_awx_task.sh
|
||||||
ADD settings.py /etc/tower/settings.py
|
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 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
|
RUN chmod -R 777 /var/log/nginx && chmod -R 777 /var/lib/nginx
|
||||||
USER 1000
|
USER 1000
|
||||||
EXPOSE 8052
|
EXPOSE 8052
|
||||||
|
|||||||
Reference in New Issue
Block a user