Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary revision #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 2 additions & 47 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,59 +30,14 @@ services:
command: server /data/minio
environment: *common-variables





# Development related
db:
env_file: hseling_web_generator/environment.env
build:
context: ./hseling_web_generator/
dockerfile: ./docker/db/Dockerfile
args:
# These values should be in sync with environment.env
# for development. If you change them, you'll
# need to rebuild the container
- POSTGRES_DB=templatesitedb
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=somepassword
- POSTGRES_PORT=5432
# Remember to keep this consistent
- django_secret_key=secret_key!

log:
env_file: hseling_web_generator/environment.env
build:
context: ./hseling_web_generator/
dockerfile: ./docker/log/Dockerfile

build-deps:
env_file: hseling_web_generator/environment.env
build:
context: ./hseling_web_generator/
dockerfile: ./docker/deps/Dockerfile
volumes:
- ./hseling_web_generator/vendor:/opt/ext_vendor
command: /opt/copy_deps.sh

dev-server:
env_file: hseling_web_generator/environment.env
environment:
- CONSOLE_LOGS=1
build:
context: ./hseling_web_generator/
args:
# Remember to keep this consistent
- django_secret_key=secret_key!
command: ./start_dev_server.sh
ports:
- "8000:80"
volumes:
- ./hseling_web_generator/src:/opt/code
#volumes:
# - ./hseling_web_generator/src:/opt/code
depends_on:
- db
- log
- hse-api-web

volumes:
Expand Down
4 changes: 0 additions & 4 deletions hseling_api_generator/.dockerignore

This file was deleted.

2 changes: 0 additions & 2 deletions hseling_api_generator/.flake8

This file was deleted.

6 changes: 0 additions & 6 deletions hseling_api_generator/.gitignore

This file was deleted.

46 changes: 20 additions & 26 deletions hseling_api_generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
FROM hseling/hseling-api-base:python3.6-alpine3.7 as build

LABEL maintainer="Boris Orekhov <[email protected]>"

RUN mkdir /dependencies
COPY ./hseling_api_generator/requirements.txt /dependencies/requirements.txt
COPY ./hseling_api_generator/setup.py /dependencies/setup.py

RUN pip install -r /dependencies/requirements.txt

FROM hseling/hseling-api-base:python3.6-alpine3.7 as production

COPY --from=build /usr/local/lib/python3.6/site-packages /usr/local/lib/python3.6/site-packages
COPY --from=build /usr/lib/python3.6/site-packages /usr/lib/python3.6/site-packages

COPY --from=build /dependencies /dependencies

COPY ./hseling_lib_generator /dependencies/hseling_lib_generator
RUN pip install /dependencies/hseling_lib_generator

COPY ./hseling_api_generator/hseling_api_generator /app/hseling_api_generator
COPY ./hseling_api_generator/main.py /app/main.py

ENV HSELING_API_GENERATOR_SETTINGS="/app/hseling_api_generator/default_settings.py"

HEALTHCHECK CMD curl --fail http://localhost/healthz || exit 1
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y \
software-properties-common
RUN apt-add-repository universe
RUN apt-get update
RUN apt-get install python-pip -y
RUN pip install flask
RUN pip install json-rpc
RUN pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl

RUN mkdir -p /app/save
WORKDIR /app
EXPOSE 80

CMD ["python","app.py"]
COPY hseling_api_generator/save/ /app/save/
COPY hseling_api_generator/model.py /app/model.py
COPY hseling_api_generator/utils.py /app/utils.py
COPY hseling_api_generator/sample.py /app/sample.py
COPY hseling_api_generator/app.py /app/app.py
2 changes: 0 additions & 2 deletions hseling_api_generator/MANIFEST.in

This file was deleted.

16 changes: 0 additions & 16 deletions hseling_api_generator/Makefile

This file was deleted.

59 changes: 0 additions & 59 deletions hseling_api_generator/README.md

This file was deleted.

29 changes: 29 additions & 0 deletions hseling_api_generator/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from flask import Flask, request, Response, jsonify
from jsonrpc import JSONRPCResponseManager, dispatcher

import sample


app = Flask(__name__)


@dispatcher.add_method
def get_text(author):
return sample.main(author)

@app.route("/rpc", methods=["POST"])
def index():
req = request.get_data().decode()
response = JSONRPCResponseManager.handle(req, dispatcher)
return Response(response.json, mimetype="application/json")


@app.route('/healthz')
def healthz():
app.logger.info('Health checked')
return jsonify({"status": "ok", "message": "Application {{cookiecutter.application_name}}"})


if __name__ == '__main__':
app.run(host="0.0.0.0", port=80)

1 change: 0 additions & 1 deletion hseling_api_generator/hseling_api_generator/__init__.py

This file was deleted.

Loading