Browse Source

Docker postgres fix (#3425)

Nate 7 years ago
parent
commit
26444d89bc

+ 4 - 0
toolset/setup/docker/databases/postgres/create-postgres.sql

@@ -1,3 +1,5 @@
+BEGIN;
+
 CREATE TABLE  World (
   id integer NOT NULL,
   randomNumber integer NOT NULL default 0,
@@ -57,3 +59,5 @@ INSERT INTO "Fortune" (id, message) VALUES (9, 'Feature: A bug with seniority.')
 INSERT INTO "Fortune" (id, message) VALUES (10, 'Computers make very fast, very accurate mistakes.');
 INSERT INTO "Fortune" (id, message) VALUES (11, '<script>alert("This should not be displayed in a browser alert box.");</script>');
 INSERT INTO "Fortune" (id, message) VALUES (12, 'フレームワークのベンチマーク');
+
+COMMIT;

+ 5 - 3
toolset/setup/docker/databases/postgres/postgres.dockerfile

@@ -37,15 +37,17 @@ RUN chown postgres:postgres /etc/sysctl.d/60-postgresql-shm.conf
 RUN chown postgres:postgres create-postgres*
 RUN chown -Rf postgres:postgres /ssd
 
+ENV PGDATA=/ssd/postgresql
+
 USER postgres
 
 # We have to wait for postgres to start before we can use the cli
 RUN service postgresql start && \
     until psql -c "\q"; do sleep 1; done && \
     psql < create-postgres-database.sql && \
-    psql -q hello_world < create-postgres.sql
+    psql -a hello_world < create-postgres.sql && \
+    service postgresql stop
 
 ENV PATH $PATH:/usr/lib/postgresql/$PG_VERSION/bin
-ENV PGDATA=/var/lib/postgresql/data 
 
-CMD ["postgres", "-D", "/ssd/postgresql"]
+CMD ["postgres"]