From 921afa5f4d5e5f6132456fbae0f7974c277c60f9 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 05 2019 15:53:49 +0000 Subject: Move all the container definition files from a docker folder to containers After all these files are not docker specific and will in fact work for every container engine (including podman which we're testing with). We're adjusting the docker-compose file to point to the right folder so it keeps working, and the .gitignore file. Signed-off-by: Pierre-Yves Chibon --- diff --git a/.gitignore b/.gitignore index 2e0d099..0bb1b03 100644 --- a/.gitignore +++ b/.gitignore @@ -48,8 +48,8 @@ Vagrantfile *.retry .vagrant -#Ignore generated dockerfile -dev/docker/test_env +# Ignore generated dockerfile +dev/containers/test_env # Tox virtualenvs .tox diff --git a/dev/containers/centos7-rpms b/dev/containers/centos7-rpms new file mode 100644 index 0000000..a23d78e --- /dev/null +++ b/dev/containers/centos7-rpms @@ -0,0 +1,32 @@ +FROM centos:7 + +RUN yum -y install \ + epel-release \ + yum-utils \ + rpm-build \ + python-setuptools \ + python-coverage \ + python-nose \ + python2-mock \ + python-docutils \ + python-enum \ + python-flask \ + redis \ + which +ADD ./fedora-infra-tags.repo /etc/yum.repos.d/infra-tags.repo + + +RUN cd /pagure && \ + yum install -y `grep "Requires:" /pagure/files/pagure.spec | \ + awk '{split($0, a, " "); print a[2]}' |grep -v "%{name}" | \ + sed -e "s|%{python_pkgversion}||"` && \ + localedef -i en_US -f UTF-8 en_US.UTF-8 + +#RUN yum -y install python2-mock redis +# yum clean all &&\ + +#ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 +WORKDIR /pagure +ENTRYPOINT ["python2", "/pagure/runtests.py", "run", "-f"] +#ENTRYPOINT ["py.test", "-x", "tests/"] +CMD [] diff --git a/dev/containers/ev b/dev/containers/ev new file mode 100644 index 0000000..005ee26 --- /dev/null +++ b/dev/containers/ev @@ -0,0 +1,22 @@ +FROM registry.fedoraproject.org/fedora:28 +MAINTAINER Patrick Uiterwijk + +VOLUME ["/repos"] +RUN mkdir /code + +RUN dnf install -y python2-devel python-setuptools python-nose py-bcrypt python-alembic \ + python-arrow python-binaryornot python-bleach python-blinker \ + python-chardet python-cryptography python-docutils python-flask \ + python-flask-wtf python-markdown python-psutil \ + python-pygit2 python-fedora python-openid python-openid-cla \ + python-openid-teams python-straight-plugin python-wtforms python-munch \ + python-enum34 python-redis python-sqlalchemy systemd gitolite3 python-filelock \ + python-fedora-flask python2-pillow python2-psycopg2 python-trololio \ + python-celery + +WORKDIR /code +ENTRYPOINT ["/usr/bin/python", "/code/pagure-ev/pagure_stream_server.py"] + +# Code injection is last to make optimal use of caches +VOLUME ["/code"] +# Openshift: COPY / /code diff --git a/dev/containers/fedora-infra-tags.repo b/dev/containers/fedora-infra-tags.repo new file mode 100644 index 0000000..4bd9b21 --- /dev/null +++ b/dev/containers/fedora-infra-tags.repo @@ -0,0 +1,6 @@ +[infrastructure-tags] +name=Fedora Infrastructure tag epel7-infra - x86_64 +baseurl=https://kojipkgs.fedoraproject.org/repos-dist/epel7-infra/latest/x86_64/ +enabled=1 +gpgcheck=1 +gpgkey=https://infrastructure.fedoraproject.org/repo/infra/RPM-GPG-KEY-INFRA-TAGS diff --git a/dev/containers/logcom b/dev/containers/logcom new file mode 100644 index 0000000..d46512d --- /dev/null +++ b/dev/containers/logcom @@ -0,0 +1,28 @@ +FROM registry.fedoraproject.org/fedora:28 +MAINTAINER Patrick Uiterwijk + +VOLUME ["/repos"] +RUN mkdir /code + +RUN dnf install -y python3-devel python3-setuptools python3-nose python3-bcrypt python3-alembic \ + python3-arrow python3-binaryornot python3-bleach python3-blinker \ + python3-chardet python3-cryptography python3-docutils python3-flask \ + python3-flask-wtf python3-markdown python3-psutil \ + python3-pygit2 python3-fedora python3-openid python3-openid-cla \ + python3-openid-teams python3-straight-plugin python3-wtforms python3-munch \ + python3-enum34 python3-redis python3-sqlalchemy systemd gitolite3 \ + python3-filelock \ + python3-fedora-flask python3-pillow python3-psycopg2 python3-requests \ + python3-kitchen + +RUN dnf install -y python3-celery + +WORKDIR /code +ENTRYPOINT ["/usr/bin/celery-3", "-A", "pagure.lib.tasks_services", "worker", "--loglevel", "info", "-Q", "pagure_logcom"] + +# Code injection is last to make optimal use of caches +VOLUME ["/code"] +# Openshift: COPY / /code +VOLUME ["/attachments"] +# Ideally this would run as non-root, but that needs the /repos owned correctly +ENV C_FORCE_ROOT true diff --git a/dev/containers/test_env_template b/dev/containers/test_env_template new file mode 100644 index 0000000..dc5869b --- /dev/null +++ b/dev/containers/test_env_template @@ -0,0 +1,15 @@ +FROM $base_image + +$epel_pkg +$infra_repo + +RUN $pkg_mgr install -y $pkg_list \ + && $pkg_mgr clean all \ +# for the hooks we need to have /usr/bin/python + && cp /usr/bin/python3 /usr/bin/python \ +# for the alembic test we need /usr/bin/alembic + && cp /usr/bin/alembic-3 /usr/bin/alembic + +WORKDIR /pagure +ENTRYPOINT [ "/pagure/runtests.py", "run" ] +CMD [] diff --git a/dev/containers/web b/dev/containers/web new file mode 100644 index 0000000..78594b0 --- /dev/null +++ b/dev/containers/web @@ -0,0 +1,26 @@ +FROM registry.fedoraproject.org/fedora:28 +MAINTAINER Patrick Uiterwijk + +VOLUME ["/repos"] +RUN mkdir /code + +RUN dnf install -y python2-devel python-setuptools python-nose python2-bcrypt python-alembic \ + python-arrow python-binaryornot python-bleach python-blinker \ + python-chardet python-cryptography python-docutils python-flask \ + python-flask-wtf python-markdown python-psutil \ + python-pygit2 python-fedora python-openid python-openid-cla \ + python-openid-teams python-straight-plugin python-wtforms python-munch \ + python-enum34 python-redis python-sqlalchemy systemd gitolite3 python-filelock \ + python-fedora-flask python2-pillow python2-psycopg2 python2-celery \ + findutils +COPY web-run /run.sh + +WORKDIR /code +# Openshift: --no-debug +ENTRYPOINT ["/usr/bin/bash", "/run.sh"] +EXPOSE 5000 + +# Code injection is last to make optimal use of caches +VOLUME ["/code"] +# Openshift: COPY / /code +VOLUME ["/attachments"] diff --git a/dev/containers/web-run b/dev/containers/web-run new file mode 100644 index 0000000..15d8668 --- /dev/null +++ b/dev/containers/web-run @@ -0,0 +1,14 @@ +#!/bin/bash -xe +pip install -r requirements-testing.txt +python setup.py build +if [ ! -f /attachments/inited ]; +then + echo "Giving Postgres time to start" + sleep 10 + touch /attachments/inited + PAGURE_CONFIG=/code/dev/openshift.cfg python createdb.py --initial /code/dev/openshift_alembic.ini +else + alembic --config /code/dev/openshift_alembic.ini upgrade head +fi + +exec /usr/bin/python /code/runserver.py --host 0.0.0.0 --config /code/dev/openshift.cfg diff --git a/dev/containers/worker b/dev/containers/worker new file mode 100644 index 0000000..c6d6ee7 --- /dev/null +++ b/dev/containers/worker @@ -0,0 +1,28 @@ +FROM registry.fedoraproject.org/fedora:28 +MAINTAINER Patrick Uiterwijk + +VOLUME ["/repos"] +RUN mkdir /code + +RUN dnf install -y python3-devel python3-setuptools python3-nose python3-bcrypt python3-alembic \ + python3-arrow python3-binaryornot python3-bleach python3-blinker \ + python3-chardet python3-cryptography python3-docutils python3-flask \ + python3-flask-wtf python3-markdown python3-psutil \ + python3-pygit2 python3-fedora python3-openid python3-openid-cla \ + python3-openid-teams python3-straight-plugin python3-wtforms python3-munch \ + python3-enum34 python3-redis python3-sqlalchemy systemd gitolite3 \ + python3-filelock python3-bleach python3-cryptography \ + python3-fedora-flask python3-pillow python3-psycopg2 python3-requests \ + python3-blinker + +RUN dnf install -y python3-celery + +WORKDIR /code +ENTRYPOINT ["/usr/bin/celery-3", "-A", "pagure.lib.tasks", "worker", "--loglevel", "info"] + +# Code injection is last to make optimal use of caches +VOLUME ["/code"] +# Openshift: COPY / /code +VOLUME ["/attachments"] +# Ideally this would run as non-root, but that needs the /repos owned correctly +ENV C_FORCE_ROOT true diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml index b04893e..cc0464b 100644 --- a/dev/docker-compose.yml +++ b/dev/docker-compose.yml @@ -4,7 +4,7 @@ volumes: services: web: build: - context: ./docker + context: ./containers dockerfile: web depends_on: - redis @@ -22,7 +22,7 @@ services: - PAGURE_CONFIG=/code/dev/openshift.cfg worker: build: - context: ./docker + context: ./containers dockerfile: worker depends_on: - redis @@ -37,7 +37,7 @@ services: - PAGURE_CONFIG=/code/dev/openshift.cfg logcom: build: - context: ./docker + context: ./containers dockerfile: logcom depends_on: - redis @@ -52,7 +52,7 @@ services: - PAGURE_CONFIG=/code/dev/openshift.cfg ev: build: - context: ./docker + context: ./containers dockerfile: ev depends_on: - redis diff --git a/dev/docker/ev b/dev/docker/ev deleted file mode 100644 index 005ee26..0000000 --- a/dev/docker/ev +++ /dev/null @@ -1,22 +0,0 @@ -FROM registry.fedoraproject.org/fedora:28 -MAINTAINER Patrick Uiterwijk - -VOLUME ["/repos"] -RUN mkdir /code - -RUN dnf install -y python2-devel python-setuptools python-nose py-bcrypt python-alembic \ - python-arrow python-binaryornot python-bleach python-blinker \ - python-chardet python-cryptography python-docutils python-flask \ - python-flask-wtf python-markdown python-psutil \ - python-pygit2 python-fedora python-openid python-openid-cla \ - python-openid-teams python-straight-plugin python-wtforms python-munch \ - python-enum34 python-redis python-sqlalchemy systemd gitolite3 python-filelock \ - python-fedora-flask python2-pillow python2-psycopg2 python-trololio \ - python-celery - -WORKDIR /code -ENTRYPOINT ["/usr/bin/python", "/code/pagure-ev/pagure_stream_server.py"] - -# Code injection is last to make optimal use of caches -VOLUME ["/code"] -# Openshift: COPY / /code diff --git a/dev/docker/fedora-infra-tags.repo b/dev/docker/fedora-infra-tags.repo deleted file mode 100644 index 4bd9b21..0000000 --- a/dev/docker/fedora-infra-tags.repo +++ /dev/null @@ -1,6 +0,0 @@ -[infrastructure-tags] -name=Fedora Infrastructure tag epel7-infra - x86_64 -baseurl=https://kojipkgs.fedoraproject.org/repos-dist/epel7-infra/latest/x86_64/ -enabled=1 -gpgcheck=1 -gpgkey=https://infrastructure.fedoraproject.org/repo/infra/RPM-GPG-KEY-INFRA-TAGS diff --git a/dev/docker/logcom b/dev/docker/logcom deleted file mode 100644 index d46512d..0000000 --- a/dev/docker/logcom +++ /dev/null @@ -1,28 +0,0 @@ -FROM registry.fedoraproject.org/fedora:28 -MAINTAINER Patrick Uiterwijk - -VOLUME ["/repos"] -RUN mkdir /code - -RUN dnf install -y python3-devel python3-setuptools python3-nose python3-bcrypt python3-alembic \ - python3-arrow python3-binaryornot python3-bleach python3-blinker \ - python3-chardet python3-cryptography python3-docutils python3-flask \ - python3-flask-wtf python3-markdown python3-psutil \ - python3-pygit2 python3-fedora python3-openid python3-openid-cla \ - python3-openid-teams python3-straight-plugin python3-wtforms python3-munch \ - python3-enum34 python3-redis python3-sqlalchemy systemd gitolite3 \ - python3-filelock \ - python3-fedora-flask python3-pillow python3-psycopg2 python3-requests \ - python3-kitchen - -RUN dnf install -y python3-celery - -WORKDIR /code -ENTRYPOINT ["/usr/bin/celery-3", "-A", "pagure.lib.tasks_services", "worker", "--loglevel", "info", "-Q", "pagure_logcom"] - -# Code injection is last to make optimal use of caches -VOLUME ["/code"] -# Openshift: COPY / /code -VOLUME ["/attachments"] -# Ideally this would run as non-root, but that needs the /repos owned correctly -ENV C_FORCE_ROOT true diff --git a/dev/docker/test_env_template b/dev/docker/test_env_template deleted file mode 100644 index dc5869b..0000000 --- a/dev/docker/test_env_template +++ /dev/null @@ -1,15 +0,0 @@ -FROM $base_image - -$epel_pkg -$infra_repo - -RUN $pkg_mgr install -y $pkg_list \ - && $pkg_mgr clean all \ -# for the hooks we need to have /usr/bin/python - && cp /usr/bin/python3 /usr/bin/python \ -# for the alembic test we need /usr/bin/alembic - && cp /usr/bin/alembic-3 /usr/bin/alembic - -WORKDIR /pagure -ENTRYPOINT [ "/pagure/runtests.py", "run" ] -CMD [] diff --git a/dev/docker/web b/dev/docker/web deleted file mode 100644 index 78594b0..0000000 --- a/dev/docker/web +++ /dev/null @@ -1,26 +0,0 @@ -FROM registry.fedoraproject.org/fedora:28 -MAINTAINER Patrick Uiterwijk - -VOLUME ["/repos"] -RUN mkdir /code - -RUN dnf install -y python2-devel python-setuptools python-nose python2-bcrypt python-alembic \ - python-arrow python-binaryornot python-bleach python-blinker \ - python-chardet python-cryptography python-docutils python-flask \ - python-flask-wtf python-markdown python-psutil \ - python-pygit2 python-fedora python-openid python-openid-cla \ - python-openid-teams python-straight-plugin python-wtforms python-munch \ - python-enum34 python-redis python-sqlalchemy systemd gitolite3 python-filelock \ - python-fedora-flask python2-pillow python2-psycopg2 python2-celery \ - findutils -COPY web-run /run.sh - -WORKDIR /code -# Openshift: --no-debug -ENTRYPOINT ["/usr/bin/bash", "/run.sh"] -EXPOSE 5000 - -# Code injection is last to make optimal use of caches -VOLUME ["/code"] -# Openshift: COPY / /code -VOLUME ["/attachments"] diff --git a/dev/docker/web-run b/dev/docker/web-run deleted file mode 100644 index 15d8668..0000000 --- a/dev/docker/web-run +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -xe -pip install -r requirements-testing.txt -python setup.py build -if [ ! -f /attachments/inited ]; -then - echo "Giving Postgres time to start" - sleep 10 - touch /attachments/inited - PAGURE_CONFIG=/code/dev/openshift.cfg python createdb.py --initial /code/dev/openshift_alembic.ini -else - alembic --config /code/dev/openshift_alembic.ini upgrade head -fi - -exec /usr/bin/python /code/runserver.py --host 0.0.0.0 --config /code/dev/openshift.cfg diff --git a/dev/docker/worker b/dev/docker/worker deleted file mode 100644 index c6d6ee7..0000000 --- a/dev/docker/worker +++ /dev/null @@ -1,28 +0,0 @@ -FROM registry.fedoraproject.org/fedora:28 -MAINTAINER Patrick Uiterwijk - -VOLUME ["/repos"] -RUN mkdir /code - -RUN dnf install -y python3-devel python3-setuptools python3-nose python3-bcrypt python3-alembic \ - python3-arrow python3-binaryornot python3-bleach python3-blinker \ - python3-chardet python3-cryptography python3-docutils python3-flask \ - python3-flask-wtf python3-markdown python3-psutil \ - python3-pygit2 python3-fedora python3-openid python3-openid-cla \ - python3-openid-teams python3-straight-plugin python3-wtforms python3-munch \ - python3-enum34 python3-redis python3-sqlalchemy systemd gitolite3 \ - python3-filelock python3-bleach python3-cryptography \ - python3-fedora-flask python3-pillow python3-psycopg2 python3-requests \ - python3-blinker - -RUN dnf install -y python3-celery - -WORKDIR /code -ENTRYPOINT ["/usr/bin/celery-3", "-A", "pagure.lib.tasks", "worker", "--loglevel", "info"] - -# Code injection is last to make optimal use of caches -VOLUME ["/code"] -# Openshift: COPY / /code -VOLUME ["/attachments"] -# Ideally this would run as non-root, but that needs the /repos owned correctly -ENV C_FORCE_ROOT true