diff --git a/README.md b/README.md index 4881ae26..e36a8049 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,6 @@ Docker is the recommended approach to quickly getting started with local develop ### **2. Start Docker** -> [!IMPORTANT] -> Please make sure the `Docker Desktop` application is **running on your computer** before you run the bash commands below. - This command starts server locally. To start it, `cd` into the project directory in your terminal then run the following command: ```bash @@ -78,22 +75,14 @@ When you see the above output, it means the site is now running and now you can - To stop the server, but not destroy it (often sufficient for day-to-day work), run `docker-compose stop` - Bring the same server back up later with `docker-compose up` -## Open Bash Shell - -> [!IMPORTANT] -> To run any of the commands below, you'll need to do the following: -> 1. Open a new terminal and `cd` into the root project directory after spinning up your Docker container -> 2. Open up a bash shell inside the Docker container with the following command: +## Commands -```bash -docker-compose exec electrify-chicago bash -``` ### Run Front-End Linting -To run linting with auto-fix, run the following command inside the Docker bash shell: +To run linting with auto-fix, run the following command: ```bash -yarn lint-fix +docker-compose run --rm electrify-chicago yarn lint-fix ``` ### Run Data Processing @@ -101,31 +90,30 @@ yarn lint-fix 1. If you update the raw data CSVs or the data scripts that post-process them (like if you are adding a new statistical analysis), you need to re-run the data processing. -2. To then process a new CSV file (at `src/data/source/ChicagoEnergyBenchmarking.csv`), you need to run the following command inside the Docker bash shell: +2. To then process a new CSV file (at `src/data/source/ChicagoEnergyBenchmarking.csv`), you need to run the following command: ```bash -bash run_all.sh +docker-compose run --rm electrify-chicago bash run_all.sh ``` ### Run Data Processing Tests -1. Make sure test data is created/replaced before running tests by running the following script from -the Docker bash shell (it will overwrite the existing test data file if it exists): +1. Make sure test data is created/replaced before running tests by running the following script (it will overwrite the existing test data file if it exists): ```bash -bash create_test_data.sh +docker-compose run --rm electrify-chicago bash create_test_data.sh ``` -2. To run all tests in the project directory, enter the following command inside the Docker bash shell: +2. To run all tests in the project directory, enter the following command: ```bash -python -m pytest +docker-compose run --rm electrify-chicago python -m pytest ``` 3. Run the following command for individual unit test suite (where YOUR_FILE_NAME is something like -`test_clean_all_years`) in the Docker bash shell: +`test_clean_all_years`): ```bash -python -m pytest tests/data/scripts/unit/YOUR_FILE_NAME.py +docker-compose run --rm electrify-chicago python -m pytest tests/data/scripts/unit/YOUR_FILE_NAME.py ``` ## Managing The Data diff --git a/docker-compose.yml b/docker-compose.yml index 5236b549..fae95a02 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,7 @@ services: dockerfile: Dockerfile ports: - "8080:8080" + entrypoint: /app/docker-entrypoint.sh volumes: - .:/app - /app/node_modules diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 00000000..1004f477 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +exec "$@" \ No newline at end of file diff --git a/tests/data/source/test_src_data.csv b/tests/data/source/test_src_data.csv index 83d037d7..70dd3cae 100644 --- a/tests/data/source/test_src_data.csv +++ b/tests/data/source/test_src_data.csv @@ -19,4 +19,4 @@ Data Year,ID,Property Name,Reporting Status,Address,ZIP Code,Chicago Energy Rati 2021,100856,United Center,Not Submitted,1901 W Madison St,60612,0.0,false,NEAR WEST SIDE,Indoor Arena,2289000,1994,1,,,,,,,,,,,,,,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2021-100856,46,29,21184,90,41 2021,256419,Crown Hall,Submitted,3360 S State Street,60616,1.0,false,DOUGLAS,College/University,54291,1955,1,,,1333307.2,0,451039945.6,0,,8332.4,10063.4,8332.4,10063.4,30138.8,555.1,41.842325,-87.62715344,"(41.842325, -87.62715344)",2021-256419,9,1,21194,377,12 2021,160196,The Art Institute of Chicago,Not Submitted,111 S Michigan Ave,60603,0.0,false,LOOP,Museum,1008416,1892,1,,,,,,,,,,,,,,41.880452,-87.624229,"(41.880452, -87.624229)",2021-160196,36,38,14311,367,22 -2021,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.88125398,-87.67448493,"(41.88125398, -87.67448493)",2021-256458,46,29,21184,90,41 +2021,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.88125398,-87.67448493,"(41.88125398, -87.67448493)",2021-256458,46,29,21184,90,41 \ No newline at end of file