From 975c35f34a153891c8113d976e193c8f282e0e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A8=D0=B0=D0=B9?= =?UTF-8?q?=D0=BA=D0=B8=D0=BD?= Date: Sun, 22 May 2022 18:41:21 +0300 Subject: [PATCH 1/2] add pip-tools add pip-tools --- .gitignore | 1 + README.md | 4 +- requirements/dev.in | 2 + requirements/dev.txt | 52 ++++++++++++++++++++++++ requirements.txt => requirements/main.in | 2 +- requirements/prod.in | 0 requirements/prod.txt | 6 +++ 7 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 requirements/dev.in create mode 100644 requirements/dev.txt rename requirements.txt => requirements/main.in (77%) create mode 100644 requirements/prod.in create mode 100644 requirements/prod.txt diff --git a/.gitignore b/.gitignore index 24806b7..818b87f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.deb *.rpm *.properties +venv diff --git a/README.md b/README.md index 879206a..4843eb3 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ configure_params: список дополнительных параметров ### ENG You will also need packages to compile Nginx. Their list can be seen in the Dockerfile. ```bash -pip3 install -r requirements.txt +pip3 install -r requirements\dev.txt ./main.py build -f [config_file].yaml -r [revision_number] ``` * revision number optional parameter, used to version assemblies @@ -106,7 +106,7 @@ pip3 install -r requirements.txt ### RU Также потребуются пакеты для компиляции Nginx. Их перечень можно увидеть в Dockerfile ```bash -pip3 install -r requirements.txt +pip3 install -r requirements\dev.txt ./main.py build -f [конфиг_файл].yaml -r [номер_ревизии] ``` * номер ревизии опциональный параметр, служит для версионирования сборок diff --git a/requirements/dev.in b/requirements/dev.in new file mode 100644 index 0000000..b6d8282 --- /dev/null +++ b/requirements/dev.in @@ -0,0 +1,2 @@ +-r main.in +pip-tools diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 0000000..239b761 --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1,52 @@ +# +# This file is autogenerated by pip-compile with python 3.9 +# To update, run: +# +# pip-compile --output-file='requirements\dev.txt' 'requirements\dev.in' +# +beautifulsoup4==4.7.1 + # via -r requirements\main.in +certifi==2022.5.18.1 + # via requests +chardet==3.0.4 + # via requests +click==8.1.3 + # via pip-tools +colorama==0.4.4 + # via click +distro==1.3.0 + # via -r requirements\main.in +gitdb==4.0.9 + # via gitpython +gitpython==3.1.0 + # via -r requirements\main.in +idna==2.7 + # via requests +packaging==19.0 + # via -r requirements\main.in +pep517==0.12.0 + # via pip-tools +pip-tools==6.6.1 + # via -r requirements\dev.in +pyparsing==3.0.9 + # via packaging +pyyaml==5.4 + # via -r requirements\main.in +requests==2.20.0 + # via -r requirements\main.in +six==1.16.0 + # via packaging +smmap==5.0.0 + # via gitdb +soupsieve==2.3.2.post1 + # via beautifulsoup4 +tomli==2.0.1 + # via pep517 +urllib3==1.24.3 + # via requests +wheel==0.37.1 + # via pip-tools + +# The following packages are considered to be unsafe in a requirements file: +# pip +# setuptools diff --git a/requirements.txt b/requirements/main.in similarity index 77% rename from requirements.txt rename to requirements/main.in index f9c835b..3bde01d 100644 --- a/requirements.txt +++ b/requirements/main.in @@ -3,4 +3,4 @@ requests==2.20.0 GitPython==3.1.0 distro==1.3.0 packaging==19.0 -beautifulsoup4==4.7.1 \ No newline at end of file +beautifulsoup4==4.7.1 diff --git a/requirements/prod.in b/requirements/prod.in new file mode 100644 index 0000000..e69de29 diff --git a/requirements/prod.txt b/requirements/prod.txt new file mode 100644 index 0000000..1f28c85 --- /dev/null +++ b/requirements/prod.txt @@ -0,0 +1,6 @@ +# +# This file is autogenerated by pip-compile with python 3.9 +# To update, run: +# +# pip-compile --output-file='requirements\prod.txt' 'requirements\prod.in' +# From d472e33c9072f83075decbc634b92df507cbf748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A8=D0=B0=D0=B9?= =?UTF-8?q?=D0=BA=D0=B8=D0=BD?= Date: Sun, 22 May 2022 18:51:26 +0300 Subject: [PATCH 2/2] add pip-tools --- .dockerignore | 7 +++++++ .travis.yml | 6 +++--- Dockerfile.centos | 34 ++++++++++++++++++++---------- Dockerfile.centos7 | 34 ++++++++++++++++++++---------- Dockerfile.ubuntu | 52 ++++++++++++++++++++++++++++++++++------------ 5 files changed, 95 insertions(+), 38 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a381836 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +venv +.idea/ +*.pyc +*.deb +*.rpm +*.properties + diff --git a/.travis.yml b/.travis.yml index 279c529..a4eb182 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,9 @@ sudo: required # Only build only master branch and tags branches: only: - - master - - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - + - master + - /^v\d+\.\d+(\.\d+)?(-\S*)?$/ + services: - docker diff --git a/Dockerfile.centos b/Dockerfile.centos index e834373..89eaec9 100644 --- a/Dockerfile.centos +++ b/Dockerfile.centos @@ -2,19 +2,31 @@ FROM centos:8 LABEL maintainer="devops@tinkoff.ru" -RUN yum install -y rpmdevtools gcc make automake yum-utils git redhat-lsb-core \ - openssl-devel zlib-devel pcre-devel epel-release \ - && yum install -y python3 python3-devel python3-pip \ +RUN yum install -y \ + rpmdevtools \ + gcc \ + make \ + automake \ + yum-utils \ + git \ + redhat-lsb-core \ + openssl-devel \ + zlib-devel \ + pcre-devel \ + epel-release \ + python3 \ + python3-devel \ + python3-pip \ && yum clean all -# Set locales -ENV LANG en_US.UTF-8 -ENV LC_CTYPE en_US.UTF-8 +ENV LANG=en_US.UTF-8 \ + LC_CTYPE=en_US.UTF-8 + TZ=Europe/Moscow \ + PROJECT_DIR=/nginx-builder -# timezone -ENV TZ Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -WORKDIR /nginx-builder -COPY . /nginx-builder -RUN pip3.6 install -r requirements.txt --no-cache-dir +WORKDIR $PROJECT_DIR +COPY . $PROJECT_DIR + +RUN pip3.6 install -r requirements\prod.txt --no-cache-dir diff --git a/Dockerfile.centos7 b/Dockerfile.centos7 index b7dd352..abcd7d5 100644 --- a/Dockerfile.centos7 +++ b/Dockerfile.centos7 @@ -2,19 +2,31 @@ FROM centos:7 LABEL maintainer="devops@tinkoff.ru" -RUN yum install -y rpmdevtools gcc make automake yum-utils git redhat-lsb-core \ - openssl-devel zlib-devel pcre-devel epel-release \ - && yum install -y python3 python3-devel python3-pip \ +RUN yum install -y \ + rpmdevtools \ + gcc \ + make \ + automake \ + yum-utils \ + git \ + redhat-lsb-core \ + openssl-devel \ + zlib-devel \ + pcre-devel \ + epel-release \ + python3 \ + python3-devel \ + python3-pip \ && yum clean all -# Set locales -ENV LANG en_US.UTF-8 -ENV LC_CTYPE en_US.UTF-8 +ENV LANG=en_US.UTF-8 \ + LC_CTYPE=en_US.UTF-8 \ + TZ=Europe/Moscow \ + PROJECT_DIR=/nginx-builder -# timezone -ENV TZ Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -WORKDIR /nginx-builder -COPY . /nginx-builder -RUN pip3.6 install -r requirements.txt --no-cache-dir +WORKDIR $PROJECT_DIR +COPY . $PROJECT_DIR + +RUN pip3.6 install -r requirements\prod.txt --no-cache-dir diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 8a5a14d..5af54c4 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -3,21 +3,47 @@ FROM ubuntu:18.04 LABEL maintainer="devops@tinkoff.ru" RUN apt-get update && \ - apt-get install -y locales wget build-essential autogen automake autoconf \ - autotools-dev libreadline-dev libncurses5-dev libpcre3 libpcre3-dev libpng-dev \ - dh-make quilt lsb-release debhelper dpkg-dev dh-systemd pkg-config \ - zlib1g-dev libssl-dev openssl git perl libtool tar unzip xutils-dev \ - python3-pip python3-apt + apt-get install -y \ + locales \ + wget \ + build-essential \ + autogen \ + automake \ + autoconf \ + autotools-dev \ + libreadline-dev \ + libncurses5-dev \ + libpcre3 \ + libpcre3-dev \ + libpng-dev \ + dh-make \ + quilt \ + lsb-release \ + debhelper \ + dpkg-dev \ + dh-systemd \ + pkg-config \ + zlib1g-dev \ + libssl-dev \ + openssl \ + git \ + perl \ + libtool \ + tar \ + unzip \ + xutils-dev \ + python3-pip \ + python3-apt -# Set locales RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LC_CTYPE en_US.UTF-8 -# timezone -ENV TZ Europe/Moscow +ENV LANG=en_US.UTF-8 \ + LC_CTYPE=en_US.UTF-8 \ + PROJECT_DIR=/nginx-builder \ + TZ=Europe/Moscow + RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -WORKDIR /nginx-builder -COPY . /nginx-builder -RUN pip3 install -r requirements.txt +WORKDIR $PROJECT_DIR +COPY . $PROJECT_DIR +RUN pip3 install -r requirements\prod.txt