瀏覽代碼

External storage was added

Denis V. Dedkov 2 年之前
父節點
當前提交
e9ed4206db
共有 4 個文件被更改,包括 7 次插入2 次删除
  1. 2 0
      .gitignore
  2. 0 1
      Dockerfile
  3. 4 0
      docker-compose.yml
  4. 1 1
      storage.py

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+storage-dev/*
+storage-prod/*

+ 0 - 1
Dockerfile

@@ -5,7 +5,6 @@ RUN pip install websockets
 WORKDIR /beerlog-srv
 WORKDIR /beerlog-srv
 COPY beerlog-srv.py .
 COPY beerlog-srv.py .
 COPY storage.py .
 COPY storage.py .
-COPY users.obj .
 
 
 ARG BEERLOG_PORT
 ARG BEERLOG_PORT
 ENV BEERLOG_PORT $BEERLOG_PORT
 ENV BEERLOG_PORT $BEERLOG_PORT

+ 4 - 0
docker-compose.yml

@@ -9,6 +9,8 @@ services:
             args:
             args:
               BEERLOG_PORT: 8000
               BEERLOG_PORT: 8000
             network: host
             network: host
+        volumes:
+            - ./storage-dev:/storage/
         ports:
         ports:
             - 8000:8000
             - 8000:8000
     beerlog-srv-prod:
     beerlog-srv-prod:
@@ -19,6 +21,8 @@ services:
             args:
             args:
               BEERLOG_PORT: 8080
               BEERLOG_PORT: 8080
             network: host
             network: host
+        volumes:
+            - ./storage-prod:/storage/
         ports:
         ports:
             - 8080:8080
             - 8080:8080
 
 

+ 1 - 1
storage.py

@@ -7,7 +7,7 @@ class Storage():
     objects = {}
     objects = {}
 
 
     def __init__(self, name):
     def __init__(self, name):
-        self.name = f"./{name}.obj"
+        self.name = f"/storage/{name}.obj"
         self._load()
         self._load()
 
 
     def _load(self):
     def _load(self):