diff --git a/.editorconfig b/.editorconfig index b42d1c753..f4db7aa05 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,5 +8,5 @@ insert_final_newline = true trim_trailing_whitespace = true [*.yaml,*.yml] -indent_style = tab +indent_style = space indent_size = 2 diff --git a/docker-compose.yml b/docker-compose.yml index c9ee75b71..8b598c8b9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,24 @@ services: # Uncomment the above lines to enable access to the PostgreSQL server # from the host machine. # Web service runs Node + dev-server: + # Comment out the this service for production + build: + context: ./ + dockerfile: ./containers/web/Dockerfile + # Using a volume allows autorebuild to work. + volumes: + - ./:/usr/src/app + ports: + - "9229:9229" + depends_on: + - web + command: + [ + "bash", + "./src/scripts/devStartVite.sh", + "${install_args:-}" + ] web: # Configuration variables for the app. environment: @@ -56,16 +74,12 @@ services: links: - database # Load the source code into the container. - # Using a volume allows autorebuild to work. volumes: - ./:/usr/src/app # List ports the container should expose # For production you might want to add "80:3000" in place of the "3000:3000" line below ports: - "3000:3000" - - "9229:9229" # Development port; should be commented out for production - - "9230:9230" - depends_on: # Don't bring this up without the DB - database diff --git a/src/scripts/devStartVite.sh b/src/scripts/devStartVite.sh new file mode 100755 index 000000000..839126251 --- /dev/null +++ b/src/scripts/devStartVite.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# * +# * This Source Code Form is subject to the terms of the Mozilla Public +# * License, v. 2.0. If a copy of the MPL was not distributed with this +# * file, You can obtain one at http://mozilla.org/MPL/2.0/. +# * + +# If we're in a container, pass '--host' flag so server remains +# accessible outside the container. +extra_args= +if [ -f /.dockerenv ]; then + # This is passed to vite, which exposts the port to the + # host (outside the container) + extra_args="--host" +fi + +npm run client:dev -- $extra_args diff --git a/src/scripts/devstart.sh b/src/scripts/devstart.sh index f5f5b7ae9..f8267a08f 100755 --- a/src/scripts/devstart.sh +++ b/src/scripts/devstart.sh @@ -6,18 +6,8 @@ # * file, You can obtain one at http://mozilla.org/MPL/2.0/. # * -# If we're in a container, pass '--host' flag so server remains -# accessible outside the container. -extra_args= -if [ -f /.dockerenv ]; then - # This is passed to vite, which exposts the port to the - # host (outside the container) - extra_args="--host" -fi - # This script is mostly for use in containerized environments, # but there's no reason not to use it in non-container ones. # It starts the autorebuild in the background and then # runs the server. -npm run vite:dev -- $extra_args & npm run start:dev