codeforboston / police-data-trust

A national archive of police data collected by journalists, lawyers, and activists around the country.
https://www.nationalpolicedata.org
MIT License
40 stars 73 forks source link

Add Dockerfile, docker-compose config #30

Closed mikeyavorsky closed 3 years ago

mikeyavorsky commented 3 years ago

Your .env file should include (along with any other required vars):

POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=police_data
POSTGRES_HOST=db

build and run with docker-compose build; docker-compose up -d; docker-compose logs -f app

dwreeves commented 3 years ago

One note about how the postgres service is defined, but otherwise LGTM

dwreeves commented 3 years ago

One more comment regarding the Postgres service. Once we've resolved that, I'll give a LGTM.

mikeyavorsky commented 3 years ago

One more comment regarding the Postgres service. Once we've resolved that, I'll give a LGTM.

@dwreeves According to the Postgres Docker image documentation, the init script and db volume can coexist: Warning: scripts in /docker-entrypoint-initdb.d are only run if you start the container with a data directory that is empty; any pre-existing database will be left untouched on container startup. See the initialization scripts section.