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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you want to use the docker container
Launch it like this:

```bash
docker run -p 6000:5432 a3c93947f86e
docker run -p 6000:5432 blog_db_container
```

and the application like this:
Expand Down
13 changes: 7 additions & 6 deletions db_container/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM ubuntu:latest
FROM ubuntu:16.04
MAINTAINER Federico Tomassetti

RUN apt-get update
RUN apt-get install -y wget
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/pgdg.list

RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

RUN apt-get update
RUN apt-get install -y python-software-properties software-properties-common
Expand All @@ -17,11 +18,11 @@ RUN echo "listen_addresses='*'" >> /etc/postgresql/9.4/main/postgresql.conf
ADD ./setup.sql /db/setup.sql
ADD ./schema.sql /db/schema.sql

RUN /etc/init.d/postgresql start && sudo -u postgres psql < /db/setup.sql && /etc/init.d/postgresql stop
RUN /etc/init.d/postgresql start && sudo -u postgres psql -d blog < /db/schema.sql && /etc/init.d/postgresql stop
USER postgres

EXPOSE 5432
RUN /etc/init.d/postgresql start && psql < /db/setup.sql && /etc/init.d/postgresql stop
RUN /etc/init.d/postgresql start && psql -d blog < /db/schema.sql && /etc/init.d/postgresql stop

USER postgres
EXPOSE 5432

CMD ["/usr/lib/postgresql/9.4/bin/postgres", "-D", "/var/lib/postgresql/9.4/main", "-c", "config_file=/etc/postgresql/9.4/main/postgresql.conf"]