Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM postgres:14.5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's been a while, but the Postgres version should be bumped to something newer (or latest?)

# requirements to run ./download
RUN apt-get update
RUN apt-get install -y wget && apt-get install -y bzip2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those could be folded into one apt-get call


COPY . omdb-postgresql
COPY docker-import /docker-entrypoint-initdb.d/docker-import.sh

WORKDIR omdb-postgresql

RUN "./download"
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,14 @@ Create `omdb.dump` database export file:
```
pg_dump -Fc -f omdb.dump omdb
```

Using docker
--------------------------
Docker compose will create postgres database
and do the importing automatically.
Created database can be accessed using credentials
specified in environment section of the docker-compose.yaml.

```shell
docker compose up
```
12 changes: 12 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3"

services:
db:
build: .
container_name: "postgres_db"
environment:
POSTGRES_PASSWORD: omdbmovies
POSTGRES_USER: omdbmovies
POSTGRES_NAME: omdbmovies
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was that supposed to be POSTGRES_DB (see below)?

ports:
- "54325:5432"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that 54325 port intentional? Wouldn't that need additional documentation on how to reach Postgres inside the container?

10 changes: 10 additions & 0 deletions docker-import
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eux

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is $POSTGRES_DB coming from, I don't see it set anywhere else?

CREATE USER docker;
CREATE DATABASE demo;
GRANT ALL PRIVILEGES ON DATABASE demo TO docker;
Comment on lines +6 to +7
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This demo database does not seem to get used anywhere?

Probably creating and using a omdb database would be better?

CREATE EXTENSION IF NOT EXISTS tsm_system_rows;
\i omdb.sql
EOSQL