diff --git a/docker-compose.yml b/docker-compose.yml index 7bab655..6097958 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,11 +11,19 @@ services: build: context: ./frontend dockerfile: Dockerfile + command: >- + sh -lc " + if [ ! -d node_modules ] || [ -z \"$(ls -A node_modules 2>/dev/null)\" ]; then + echo '[frontend] Installing dependencies...'; + npm install --silent; + fi; + npm start + " environment: - REACT_APP_API_URL=https://turftracker.kaspers.us/api volumes: - ./frontend:/app - - /app/node_modules + - frontend_node_modules:/app/node_modules depends_on: - backend networks: @@ -35,6 +43,14 @@ services: build: context: ./backend dockerfile: Dockerfile + command: >- + sh -lc " + if [ ! -d node_modules ] || [ -z \"$(ls -A node_modules 2>/dev/null)\" ]; then + echo '[backend] Installing production dependencies...'; + npm install --only=production --silent; + fi; + npm start + " environment: - NODE_ENV=development - DB_HOST=db @@ -99,3 +115,5 @@ services: volumes: postgres_data: + frontend_node_modules: + backend_node_modules: diff --git a/scripts/deploy.sh b/scripts/deploy.sh old mode 100644 new mode 100755