From b9e59a307c306b698d19102a27cebf19f8616b95 Mon Sep 17 00:00:00 2001 From: Bastien Abadie <bastien@nextcairn.com> Date: Mon, 7 May 2018 16:39:53 +0200 Subject: [PATCH] Working setup.py + docker --- .gitignore | 2 ++ Dockerfile | 13 +++++-------- setup.py | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 75cfb4087a..37784224e7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ db.sqlite3 playbook.retry *.egg-info +build +dist diff --git a/Dockerfile b/Dockerfile index 626f574532..9eaae2780e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,20 +7,17 @@ ARG GITLAB_TOKEN="gTPA5UQYesSuKMCRM2r_" # Add system dependencies RUN apk add --update --no-cache postgresql-dev jpeg-dev build-base wget gzip -# Use current backend source code -ADD . /backend +# Setup frontend +ENV FRONTEND_DIR="/frontend/dist" +RUN mkdir /frontend && wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/arkindex/frontend/-/jobs/artifacts/$FRONTEND_BRANCH/download?job=frontend -O /tmp/frontend.zip && unzip /tmp/frontend.zip -d /frontend && rm /tmp/frontend.zip # Install arkindex -RUN pip3 install /backend +ADD . /backend +RUN cd /backend && python setup.py install # Setup gunicorn RUN pip3 install gunicorn -# Setup frontend -ENV FRONTEND_DIR="/frontend/dist" -RUN wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/arkindex/frontend/-/jobs/artifacts/$FRONTEND_BRANCH/download?job=frontend -O /tmp/frontend.zip && unzip /tmp/frontend.zip -d /frontend && rm /tmp/frontend.zip - # Run through supervisor EXPOSE 80 -WORKDIR /backend CMD ["gunicorn", "--access-logfile=-", "--capture-output", "--bind=0.0.0.0:80", "--chdir=/backend", "arkindex.project.wsgi"] diff --git a/setup.py b/setup.py index 270d06082f..775e1a8dd2 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from distutils.core import setup +from setuptools import setup, find_packages with open('VERSION') as f: VERSION = f.read() @@ -15,7 +15,7 @@ setup( author_email='abadie@teklia.com', url='https://arkindex.teklia.com', install_requires=requirements, - packages=['arkindex'], + packages=find_packages(), scripts=[ 'arkindex/manage.py', ], -- GitLab