banjtheman / defundthepolice

Defund The Police
Apache License 2.0
20 stars 30 forks source link

#32: Add dockerfile for creating posgres container with all CSV data loaded. #39

Closed ginglis13 closed 4 years ago

ginglis13 commented 4 years ago

Description

Addresses #32

Added a short Dockerfile that uses the Postgres docker image to initialize a table, "budget_data", with all CSV data in /data/states. Included CreateDB.sql, which contains the SQL commands to run on initializing the Postgres daemon.

How to use it

  1. docker build -t "db:PostgresDockerfile" . -f PostgresDockerfile
  2. docker run -d db:PostgresDockerfile # this will output a hash for the running container
  3. docker exec -it $HASH psql -U docker # use the hash output from command 2
  4. Now that you are in Postgres as user docker, run select * from "budget_data";. The quotes are important.

Organization

I have these files currently at the top level directory of this project, but if that causes too much clutter, we can find a different place for them.

banjtheman commented 4 years ago

Works, yeah will reorg the project after API image built