Skip to content

Commit b50da11

Browse files
committed
Create dockerfile and compose.
1 parent b7375ca commit b50da11

File tree

4 files changed

+186
-71
lines changed

4 files changed

+186
-71
lines changed

compose/docker-compose.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
2+
services:
3+
4+
postgres:
5+
image: docker.io/postgres:latest
6+
restart: always
7+
ports:
8+
- '${DB_PORT}:${DB_PORT}'
9+
environment:
10+
POSTGRES_PASSWORD: ${DB_PASSWORD}
11+
POSTGRES_USER: ${DB_USER}
12+
POSTGRES_DB: ${DB_NAME}
13+
healthcheck:
14+
test: ["CMD-SHELL", "pg_isready", "-d", "$$POSTGRES_DB","-U", "$$POSTGRES_USER"]
15+
interval: 30s
16+
timeout: 60s
17+
retries: 5
18+
start_period: 40s
19+
20+
mb3server:
21+
build: ../
22+
restart: always
23+
ports:
24+
- "${MB3_API_PORT}:${MB3_SERVER_PORT}"
25+
depends_on:
26+
- postgres
27+
environment:
28+
- DB_TYPE
29+
- DB_PORT
30+
- DB_PASSWORD
31+
- DB_HOST
32+
- DB_NAME
33+
- DB_CONN_STRING
34+
- MB3_SERVER_PORT
35+
- CDKDEPICT_URL
36+
37+
similarity-service-cosine:
38+
build: ../similarity-service-cosine
39+
restart: always
40+
ports:
41+
- "${SIMILARITY_SERVICE_COSINE_PORT}:8080"
42+
depends_on:
43+
- postgres
44+
environment:
45+
- DB_PORT
46+
- DB_USER
47+
- DB_PASSWORD
48+
- DB_HOST
49+
- DB_NAME
50+
51+
mb3frontend:
52+
build:
53+
context: ..
54+
dockerfile: Dockerfile-frontend
55+
args:
56+
MB3_API_URL: "http://${MB3_API_HOST}:${MB3_API_PORT}"
57+
MB3_FRONTEND_BASE_URL: "${MB3_FRONTEND_BASE_URL}"
58+
restart: always
59+
ports:
60+
- "${MB3_FRONTEND_PORT}:3000"
61+
62+
mb3tool:
63+
build:
64+
context: ..
65+
dockerfile: Dockerfile-dbtool
66+
environment:
67+
- DB_TYPE
68+
- DB_PORT
69+
- DB_USER
70+
- DB_PASSWORD
71+
- DB_HOST
72+
- DB_NAME
73+
- DB_CONN_STRING
74+
- MB_GIT_REPO
75+
- MB_GIT_BRANCH
76+
- MB_DATA_DIRECTORY
77+
- MB_DROP_ALL

compose/env.dist

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
############################
2+
# Massbank 3 configuration #
3+
############################
4+
5+
# --------------------
6+
# Server configuration
7+
# --------------------
8+
9+
# The port where the API is exposed for frontend and application usage
10+
MB3_API_PORT=8081
11+
12+
# The host where the frontend is running
13+
MB3_API_HOST=localhost
14+
15+
# The port used internally by the server
16+
MB3_SERVER_PORT=8080
17+
18+
19+
# ----------------------
20+
# Frontend configuration
21+
# ----------------------
22+
23+
# The Port where the frontend ist exposed
24+
MB3_FRONTEND_PORT=8080
25+
26+
# The base URL
27+
MB3_FRONTEND_BASE_URL=/massbank3/
28+
29+
# ----------------------
30+
# Database configuration
31+
# ----------------------
32+
33+
# The database type: "mongodb" or "postgres"
34+
DB_TYPE=postgres
35+
36+
# The port of the database
37+
DB_PORT=5432
38+
39+
# The database user name
40+
DB_USER=massbank3
41+
42+
# The database password
43+
DB_PASSWORD=massbank3password
44+
45+
# The database host name
46+
DB_HOST=localhost
47+
48+
# The name of the database
49+
DB_NAME=massbank3
50+
51+
# A connection string to connect with the database. If set to non empty string other "DB_..." environment variables will be ignored
52+
DB_CONN_STRING=""
53+
54+
# ------------------------------
55+
# Similarity microservice cosine
56+
# ------------------------------
57+
58+
# The port where the similarity service is exposed
59+
SIMILARITY_SERVICE_COSINE_PORT=8082
60+
61+
# The host where the similarity service is running
62+
SIMILARITY_SERVICE_COSINE_HOST=localhost
63+
64+
# ---------------------------
65+
# Massbank-data configuration
66+
# ---------------------------
67+
68+
# The repo where to load massbank data from
69+
MB_GIT_REPO="https://github.com/MassBank/MassBank-data"
70+
71+
# The git branch of the massbank data repo
72+
MB_GIT_BRANCH=main
73+
74+
# A directory where the massbank data is stored. If set, this will tried first before getting data from git.
75+
MB_DATA_DIRECTORY=""
76+
77+
# Set to true to clear the database before filling with new data, otherwise data is upserted.
78+
MB_DROP_ALL=true
79+
Lines changed: 6 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,7 @@
1-
.travis.yaml
2-
.openapi-generator-ignore
3-
README.md
4-
tox.ini
5-
git_push.sh
6-
test-requirements.txt
7-
setup.py
1+
#project files and folders
2+
.idea/
3+
Dockerfile
84

9-
# Byte-compiled / optimized / DLL files
10-
__pycache__/
11-
*.py[cod]
12-
*$py.class
13-
14-
# C extensions
15-
*.so
16-
17-
# Distribution / packaging
18-
.Python
19-
env/
20-
build/
21-
develop-eggs/
22-
dist/
23-
downloads/
24-
eggs/
25-
.eggs/
26-
lib/
27-
lib64/
28-
parts/
29-
sdist/
30-
var/
31-
*.egg-info/
32-
.installed.cfg
33-
*.egg
34-
35-
# PyInstaller
36-
# Usually these files are written by a python script from a template
37-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
38-
*.manifest
39-
*.spec
40-
41-
# Installer logs
42-
pip-log.txt
43-
pip-delete-this-directory.txt
44-
45-
# Unit test / coverage reports
46-
htmlcov/
47-
.tox/
48-
.coverage
49-
.coverage.*
50-
.cache
51-
nosetests.xml
52-
coverage.xml
53-
*,cover
54-
.hypothesis/
55-
venv/
56-
.python-version
57-
58-
# Translations
59-
*.mo
60-
*.pot
61-
62-
# Django stuff:
63-
*.log
64-
65-
# Sphinx documentation
66-
docs/_build/
67-
68-
# PyBuilder
69-
target/
70-
71-
#Ipython Notebook
72-
.ipynb_checkpoints
5+
#generated folders
6+
gen/
7+
venv/

similarity-service-cosine/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM python:3.11-bookworm
2+
RUN apt update && apt install -y default-jre-headless
3+
4+
COPY generate.sh openapi-generator-cli.jar openapi.yaml /usr/src/app/
5+
6+
WORKDIR /usr/src/app
7+
RUN bash generate.sh
8+
9+
FROM python:3.11-slim-bookworm
10+
COPY requirements.txt /usr/src/app/
11+
COPY cosine_impl /usr/src/app/cosine_impl
12+
COPY --from=0 /usr/src/app/openapi.yaml /usr/src/app/openapi.yaml
13+
COPY --from=0 /usr/src/app/gen /usr/src/app/gen
14+
15+
WORKDIR /usr/src/app
16+
RUN pip3 install --no-cache-dir -r requirements.txt
17+
18+
ENV PYTHONPATH=/usr/src/app/gen
19+
20+
EXPOSE 8080
21+
22+
ENTRYPOINT ["python3"]
23+
24+
CMD ["-m", "cosine_impl"]

0 commit comments

Comments
 (0)