]> git.lizzy.rs Git - cheatdb.git/commitdiff
Add reloading support to Docker container
authorrubenwardy <rw@rubenwardy.com>
Sat, 18 Jan 2020 01:38:00 +0000 (01:38 +0000)
committerrubenwardy <rw@rubenwardy.com>
Sat, 18 Jan 2020 01:38:00 +0000 (01:38 +0000)
app/blueprints/thumbnails/__init__.py
app/models.py
app/tasks/phpbbparser.py
app/utils.py
docker-compose.yml
utils/reload.sh [new file with mode: 0755]

index 820d22810b2db6c86f84b3520247cb44186c425c..109cc0c4a11ea361e757240d81dadcff465ab9b3 100644 (file)
@@ -25,7 +25,7 @@ from PIL import Image
 ALLOWED_RESOLUTIONS=[(100,67), (270,180), (350,233)]
 
 def mkdir(path):
-       assert(path != "" and path is not None)
+       assert path != "" and path is not None
        if not os.path.isdir(path):
                os.mkdir(path)
 
index 736a0dce8cbd6315490e523f5d86b0963e6c1854..34b689c41df436b251deb1f84699b57447c4cf72 100644 (file)
@@ -752,7 +752,7 @@ class PackageRelease(db.Model):
                                not self.package.checkPerm(user, Permission.APPROVE_RELEASE):
                        return False
 
-               assert(self.task_id is None and self.url is not None and self.url != "")
+               assert self.task_id is None and self.url is not None and self.url != ""
 
                self.approved = True
                return True
index d3e12319793b210568386686a61d2a8a2c539966..3df8470989f938d5d0e9eadf03f59d721b265a94 100644 (file)
@@ -121,7 +121,7 @@ def parseForumListPage(id, page, out, extra=None):
 
                if id in out:
                        print("   - got {} again, title: {}".format(id, title))
-                       assert(title == out[id]['title'])
+                       assert title == out[id]['title']
                        return False
 
                row = {
index 5d1c8da2937623c8c0b4b94726ce7dc6207d40af..983111cab3fc76b0836db3c91f1f293d9ef8463e 100644 (file)
@@ -46,13 +46,13 @@ def randomString(n):
        return ''.join(random.choice(string.ascii_lowercase + \
                        string.ascii_uppercase + string.digits) for _ in range(n))
 
-assert(os.path.isdir(app.config["UPLOAD_DIR"]), "UPLOAD_DIR must exist")
-
 def doFileUpload(file, fileType, fileTypeDesc):
        if not file or file is None or file.filename == "":
                flash("No selected file", "error")
                return None
 
+       assert os.path.isdir(app.config["UPLOAD_DIR"]), "UPLOAD_DIR must exist"
+
        allowedExtensions = []
        isImage = False
        if fileType == "image":
index 40b345f5452eeaaf946f77c261385b7a75109b6b..a8b8ebbc72dc8580ef8c1c0421f1de4350906f37 100644 (file)
@@ -22,6 +22,8 @@ services:
       - 5123:5123
     volumes:
       - "./data/uploads:/var/cdb/uploads"
+      - "./app:/source/app"
+      - "./migrations:/source/migrations"
     depends_on:
       - db
       - redis
@@ -35,6 +37,7 @@ services:
       - FLASK_CONFIG=../config.cfg
     volumes:
       - "./data/uploads:/var/cdb/uploads"
+      - "./app:/home/cdb/app"
     depends_on:
       - redis
 
diff --git a/utils/reload.sh b/utils/reload.sh
new file mode 100755 (executable)
index 0000000..e399515
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+docker exec -it contentdb_app_1 sh -c "cp -r /source/* ."