Skip to content

Commit

Permalink
add volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPorshnev committed Dec 21, 2024
1 parent b1533dd commit 42f79a5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
NEO4J_USER=neo4j
NEO4J_PASSWORD=12345678
NEO4J_AUTH=neo4j/12345678
4 changes: 3 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .
COPY app.py /app/app.py

VOLUME ["/app/db"]

ENV NEO4J_URI=bolt://neo4j:7687
ENV NEO4J_USER=neo4j
Expand Down
7 changes: 4 additions & 3 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import os

uri = os.getenv("NEO4J_URI", "bolt://neo4j:7687")
username = os.getenv("NEO4J_USER", "neo4j")
password = os.getenv("NEO4J_PASSWORD", "12345678")
auth = os.getenv("NEO4J_AUTH", "neo4j/12345678").split('/')
username = auth[0]
password = auth[1]

driver = GraphDatabase.driver(uri, auth=(username, password))

Expand Down Expand Up @@ -384,5 +385,5 @@ def export_data():

if __name__ == "__main__":
clear_database()
import_toponyms("toponyms_data.json")
import_toponyms("db/toponyms_data.json")
app.run(debug=True, port=5001, host='0.0.0.0')
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ services:
ports:
- "127.0.0.1:5001:5001"
environment:
- NEO4J_USER=${NEO4J_USER}
- NEO4J_PASSWORD=${NEO4J_PASSWORD}
NEO4J_AUTH: ${NEO4J_AUTH}
volumes:
- ./backend/db:/app/db
depends_on:
db:
condition: service_healthy
Expand Down

0 comments on commit 42f79a5

Please sign in to comment.