Skip to content

Commit

Permalink
Merge pull request #90 from vkoves/docker-entrypoint
Browse files Browse the repository at this point in the history
add docker-entrypoint
  • Loading branch information
vkoves authored Apr 24, 2024
2 parents 65b1e94 + 7b19c15 commit 398ffb7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
34 changes: 11 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -78,54 +75,45 @@ 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

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
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
dockerfile: Dockerfile
ports:
- "8080:8080"
entrypoint: /app/docker-entrypoint.sh
volumes:
- .:/app
- /app/node_modules
Expand Down
4 changes: 4 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e

exec "$@"
2 changes: 1 addition & 1 deletion tests/data/source/test_src_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 398ffb7

Please sign in to comment.