Browse Source

refactor: Add compose file for local mounts

Owen Diffey 1 month ago
parent
commit
23a1e4909c
5 changed files with 23 additions and 12 deletions
  1. 1 0
      .env.example
  2. 1 0
      .wiki/Configuration.md
  3. 0 12
      docker-compose.dev.yml
  4. 18 0
      docker-compose.local.yml
  5. 3 0
      musare.sh

+ 1 - 0
.env.example

@@ -1,5 +1,6 @@
 COMPOSE_PROJECT_NAME=musare
 DOCKER_COMMAND=docker
+CONTAINER_MODE=production
 
 APP_ENV=production
 

+ 1 - 0
.wiki/Configuration.md

@@ -26,6 +26,7 @@ machine, even though the application within the container is listening on `21017
 | --- | --- |
 | `COMPOSE_PROJECT_NAME` | Should be a unique name for this installation, especially if you have multiple instances of Musare on the same machine. |
 | `DOCKER_COMMAND` | Should be either `docker` or `podman`.  |
+| `CONTAINER_MODE` | Should be either `production` or `local`.  |
 | `APP_ENV` | Should be either `production` or `development`.  |
 | `BACKEND_HOST` | Backend container host. Only used for development mode. |
 | `BACKEND_PORT` | Backend container port. Only used for development mode. |

+ 0 - 12
docker-compose.dev.yml

@@ -5,11 +5,6 @@ services:
     ports:
       - "${BACKEND_HOST:-0.0.0.0}:${BACKEND_PORT:-8080}:8080"
       - "${BACKEND_HOST:-0.0.0.0}:${BACKEND_DEBUG_PORT:-9229}:9229"
-    volumes:
-      - ./.git:/opt/.git:ro
-      - ./common:/opt/common
-      - ./types:/opt/types
-      - ./backend:/opt/app
     environment:
       - APP_ENV=${APP_ENV:-development}
       - BACKEND_DEBUG=${BACKEND_DEBUG:-false}
@@ -17,11 +12,6 @@ services:
   frontend:
     build:
       dockerfile: ./Dockerfile.dev
-    volumes:
-      - ./.git:/opt/.git:ro
-      - ./common:/opt/common
-      - ./types:/opt/types
-      - ./frontend:/opt/app
     environment:
       - APP_ENV=${APP_ENV:-development}
 
@@ -32,5 +22,3 @@ services:
   redis:
     ports:
       - "${REDIS_HOST:-0.0.0.0}:${REDIS_PORT:-6379}:6379"
-    volumes:
-      - ${REDIS_DATA_LOCATION:-./redis}:/data

+ 18 - 0
docker-compose.local.yml

@@ -0,0 +1,18 @@
+services:
+  backend:
+    volumes:
+      - ./.git:/opt/.git:ro
+      - ./common:/opt/common
+      - ./types:/opt/types
+      - ./backend:/opt/app
+
+  frontend:
+    volumes:
+      - ./.git:/opt/.git:ro
+      - ./common:/opt/common
+      - ./types:/opt/types
+      - ./frontend:/opt/app
+
+  redis:
+    volumes:
+      - ${REDIS_DATA_LOCATION:-./redis}:/data

+ 3 - 0
musare.sh

@@ -73,6 +73,9 @@ composeFiles="-f docker-compose.yml"
 if [[ ${APP_ENV} == "development" ]]; then
     composeFiles="${composeFiles} -f docker-compose.dev.yml"
 fi
+if [[ ${CONTAINER_MODE} == "local" ]]; then
+    composeFiles="${composeFiles} -f docker-compose.local.yml"
+fi
 if [[ -f docker-compose.override.yml ]]; then
     composeFiles="${composeFiles} -f docker-compose.override.yml"
 fi