diff --git a/Dockerfile b/Dockerfile index 03310020..bacfc3b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,8 @@ WORKDIR /workspace/ COPY ./client /workspace/client RUN npm install -g --quiet \ - @vue/cli@3.3.0 \ - @vue/cli-service@3.3.0 + @vue/cli@3.3.0 \ + @vue/cli-service@3.3.0 COPY ./client/package* /workspace/ @@ -15,34 +15,11 @@ ENV NODE_PATH=/workspace/node_modules WORKDIR /workspace/client RUN npm run build -# Setup flask - -FROM python:3.6 +FROM jsbroks/coco-annotator:python-env WORKDIR /workspace/ - -# Install python package dependices COPY ./backend/ /workspace/ -RUN pip install -r requirements.txt && \ - pip install gunicorn[eventlet]==19.9.0 && \ - pip install pycocotools - -# Install maskrcnn -RUN git clone --single-branch --depth 1 https://github.com/matterport/Mask_RCNN.git /tmp/maskrcnn && \ - cd /tmp/maskrcnn && \ - pip install -r requirements.txt && \ - python3 setup.py install - -# Install DEXTR -RUN git clone --single --depth 1 https://github.com/jsbroks/dextr-keras.git /tmp/dextr && \ - cd /tmp/dextr && \ - pip install -r requirements.txt && \ - python setup.py install - COPY ./.git /workspace/.git - -# Create server -WORKDIR /workspace/ RUN python set_path.py COPY --from=build-stage /workspace/client/dist /workspace/dist diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 00000000..1ec98c3f --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,25 @@ +# Backend environment docker image +FROM python:3.6 + +WORKDIR /workspace/ + +# Copy backend +COPY ./backend/requirements.txt /workspace/ + +# Install python package dependices +RUN pip install -r requirements.txt && \ + pip install gunicorn[eventlet]==19.9.0 && \ + pip install pycocotools + +# Install maskrcnn +RUN git clone --single-branch --depth 1 https://github.com/matterport/Mask_RCNN.git /tmp/maskrcnn && \ + cd /tmp/maskrcnn && \ + pip install -r requirements.txt && \ + python3 setup.py install + +# Install DEXTR +RUN git clone --single --depth 1 https://github.com/jsbroks/dextr-keras.git /tmp/dextr && \ + cd /tmp/dextr && \ + pip install -r requirements.txt && \ + python setup.py install + diff --git a/backend/config/config.py b/backend/config/config.py index 545586b1..d980e18d 100644 --- a/backend/config/config.py +++ b/backend/config/config.py @@ -32,7 +32,7 @@ class Config: # spawned to replace it. # SWAGGER_UI_JSONEDITOR = True - DEBUG = os.getenv("DEBUG", False) + DEBUG = os.getenv("DEBUG", 'false').lower() == 'true' PRELOAD = False MAX_CONTENT_LENGTH = os.getenv("MAX_CONTENT_LENGTH", 1 * 1024 * 1024 * 1024) # 1GB diff --git a/backend/webserver/Dockerfile b/backend/webserver/Dockerfile new file mode 100644 index 00000000..cb8fe628 --- /dev/null +++ b/backend/webserver/Dockerfile @@ -0,0 +1,16 @@ +FROM jsbroks/coco-annotator:python-env + +WORKDIR /workspace/ + +# Install python package dependices +COPY ./backend/ /workspace/ +COPY ./.git /workspace/.git +RUN python set_path.py + +ENV FLASK_ENV=development +ENV DEBUG=true + +EXPOSE 5000 +CMD gunicorn -c webserver/gunicorn_config.py webserver:app --no-sendfile + + diff --git a/backend/webserver/__init__.py b/backend/webserver/__init__.py index e7ab3f13..f6d5f9a9 100644 --- a/backend/webserver/__init__.py +++ b/backend/webserver/__init__.py @@ -73,7 +73,7 @@ def create_app(): @app.route('/', defaults={'path': ''}) @app.route('/') def index(path): - + if app.debug: return requests.get('http://frontend:8080/{}'.format(path)).text diff --git a/backend/workers/Dockerfile b/backend/workers/Dockerfile index 958739fa..81626d31 100644 --- a/backend/workers/Dockerfile +++ b/backend/workers/Dockerfile @@ -1,12 +1,9 @@ -FROM python:3.6 +FROM jsbroks/coco-annotator:python-env WORKDIR /workspace/ # Install python package dependices COPY ./backend/ /workspace/ -COPY ./.git /workspace/.git - -RUN pip install -r requirements.txt EXPOSE 5555 CMD celery -A workers worker -l info