From e279d1a832b03ca38ca36e30cb5201c83d5cde0d Mon Sep 17 00:00:00 2001
From: Desmarchelier Maxime <maxime.desmarchelier@ensiie.fr>
Date: Thu, 17 Nov 2022 10:19:43 +0100
Subject: [PATCH] Add redis container Add redis client container

---
 docker-compose.yml      |  8 +++++++-
 docker-compose1.yml     | 17 -----------------
 redis/Dockerfile        |  5 +++++
 redis/client_example.py |  6 ++++++
 redis/requirements.txt  |  1 +
 5 files changed, 19 insertions(+), 18 deletions(-)
 delete mode 100644 docker-compose1.yml
 create mode 100644 redis/Dockerfile
 create mode 100644 redis/client_example.py
 create mode 100644 redis/requirements.txt

diff --git a/docker-compose.yml b/docker-compose.yml
index 43c78e1..99e4414 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -11,4 +11,10 @@ services:
         volumes:
             - ./neo4j/import:/var/lib/neo4j/import
             - ./neo4j/conf:/var/lib/neo4j/conf
-            - ./neo4j/data:/var/lib/neo4j/data
\ No newline at end of file
+            - ./neo4j/data:/var/lib/neo4j/data
+    redis:
+        image: "redis:alpine"
+        ports:
+            - "6379:6379"
+    redis-client:
+        build: ./redis
\ No newline at end of file
diff --git a/docker-compose1.yml b/docker-compose1.yml
deleted file mode 100644
index b90db39..0000000
--- a/docker-compose1.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-version: '1'
-
-services:
-  neo4j:
-    build: ./neo4j
-    restart: "no"
-    ports:
-      - 7474:7474
-      - 7687:7687
-    volumes:
-      - ./neo4j/conf:/conf
-      - ./neo4j/data:/data
-      - ./neo4j/import:/import
-      - ./neo4j/logs:/logs
-      - ./neo4j/plugins:/plugins
-    environment:
-      - NEO4J_AUTH=neo4j/test
\ No newline at end of file
diff --git a/redis/Dockerfile b/redis/Dockerfile
new file mode 100644
index 0000000..c317216
--- /dev/null
+++ b/redis/Dockerfile
@@ -0,0 +1,5 @@
+FROM python:latest
+COPY client_example.py ./client.py
+COPY requirements.txt ./requirements.txt
+RUN pip3 install -r requirements.txt
+CMD [ "python", "./client.py"]
\ No newline at end of file
diff --git a/redis/client_example.py b/redis/client_example.py
new file mode 100644
index 0000000..092bffd
--- /dev/null
+++ b/redis/client_example.py
@@ -0,0 +1,6 @@
+import redis
+
+r = redis.Redis(host='redis', port=6379, db=0)
+r.set('foo', 'bar')
+result = r.get('foo')
+print(result)
diff --git a/redis/requirements.txt b/redis/requirements.txt
new file mode 100644
index 0000000..88e7829
--- /dev/null
+++ b/redis/requirements.txt
@@ -0,0 +1 @@
+redis==4.3.4
\ No newline at end of file
-- 
GitLab