From 6cc721163087b02f0fff2548650e87cc635f8cc4 Mon Sep 17 00:00:00 2001 From: Bryan Strassner Date: Fri, 16 Feb 2018 11:59:23 -0600 Subject: [PATCH] Cleanup dockerfile and add editorconfig Updates dockerfile to use python 3.5 base image and reorders to take advantage of image layering caching better Removes some outdated and unused files adds .editorconfig file adds .vscode to gitignore Change-Id: I08571b7176f0cb9fab42f072326c6c14d86d518a --- .editorconfig | 27 ++++++++++++++++ .gitignore | 3 ++ images/shipyard/Dockerfile | 64 ++++++++++---------------------------- shipyard_airflow/README.md | 12 ------- shipyard_client/setup.cfg | 18 ----------- 5 files changed, 46 insertions(+), 78 deletions(-) create mode 100644 .editorconfig delete mode 100644 shipyard_airflow/README.md delete mode 100644 shipyard_client/setup.cfg diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..0c542695 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,27 @@ +# EditorConfig is awesome: http://EditorConfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.py] +# Note: Undercloud components use PEP8 line length of 79 +# Note: for VS Code, set "editor.rulers":[79] in your workspace settings +max_line_length = 79 + +[*.{yml,yaml}] +indent_size = 2 + +[Makefile] +indent_style = tab + +[*.md] +# Note: VS Code may not honor the following setting +# See: https://github.com/editorconfig/editorconfig-vscode/issues/153 +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.gitignore b/.gitignore index 21325a59..78787920 100644 --- a/.gitignore +++ b/.gitignore @@ -110,3 +110,6 @@ AUTHORS /charts/shipyard/charts /charts/shipyard/requirements.lock .DS_Store + +# vscode +.vscode/ \ No newline at end of file diff --git a/images/shipyard/Dockerfile b/images/shipyard/Dockerfile index 0b9bd86a..9cdf994b 100644 --- a/images/shipyard/Dockerfile +++ b/images/shipyard/Dockerfile @@ -12,69 +12,37 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:16.04 +FROM python:3.5 ENV DEBIAN_FRONTEND noninteractive ENV container docker +ENV PORT 9000 ENV LC_ALL C.UTF-8 ENV LANG C.UTF-8 -RUN set -x && \ - apt-get -qq update && \ - apt-get -y install \ - git \ - curl \ - netcat \ - netbase \ - python3 \ - python3-setuptools \ - python3-pip \ - python3-dev \ - python3-dateutil \ - ca-certificates \ - gcc \ - g++ \ - make \ - libffi-dev \ - libssl-dev \ - libpq-dev \ - --no-install-recommends \ - && python3 -m pip install -U pip \ - && apt-get clean \ - && rm -rf \ - /var/lib/apt/lists/* \ - /tmp/* \ - /var/tmp/* \ - /usr/share/man \ - /usr/share/doc \ - /usr/share/doc-base +# Expose port 9000 for application +EXPOSE $PORT + +# Execute entrypoint +ENTRYPOINT ["/home/shipyard/entrypoint.sh"] +CMD ["server"] # Create shipyard user RUN useradd -ms /bin/bash shipyard -# Clone the shipyard repository -COPY . /home/shipyard/shipyard - -# Set work directory -# Install dependency requirements and packages -WORKDIR /home/shipyard/shipyard -RUN pip3 install -r requirements.txt -RUN python3 setup.py install - # Copy entrypoint.sh to /home/shipyard COPY entrypoint.sh /home/shipyard/entrypoint.sh - # Change permissions RUN chown -R shipyard: /home/shipyard \ && chmod +x /home/shipyard/entrypoint.sh +# Set work directory and install dependencies +WORKDIR /home/shipyard/shipyard +COPY requirements.txt /home/shipyard/shipyard +RUN pip3 install -r requirements.txt + +COPY . /home/shipyard/shipyard +RUN python3 setup.py install + # Set user to shipyard USER shipyard - -# Expose port 9000 for application -EXPOSE 9000 - -# Execute entrypoint -ENTRYPOINT ["/home/shipyard/entrypoint.sh"] - -CMD ["server"] diff --git a/shipyard_airflow/README.md b/shipyard_airflow/README.md deleted file mode 100644 index 88496910..00000000 --- a/shipyard_airflow/README.md +++ /dev/null @@ -1,12 +0,0 @@ -## Shipyard Airflow ## - -A python REST workflow orchestrator - -To run: - -``` -$ virtualenv -p python3 /var/tmp/shipyard -$ . /var/tmp/shipyard/bin/activate -$ python setup.py install -$ uwsgi --http :9000 -w shipyard_airflow.shipyard --callable shipyard -L -``` diff --git a/shipyard_client/setup.cfg b/shipyard_client/setup.cfg deleted file mode 100644 index ab01613c..00000000 --- a/shipyard_client/setup.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[metadata] -name = shipyard client -summary = Shipyard client library and CLI -description-file = README.md - -author = undercloud team -home-page = https://github.com/att-comdev/shipyard/shipyard_client -classifier = - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.5 - -[build_sphinx] -warning-is-error = True