Guest User

Untitled

a guest
Dec 5th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. # base image
  2. FROM postgres:10.4-alpine
  3.  
  4. # run the db file on init
  5. ADD yourappdb.sql /docker-entrypoint-initdb.d
  6.  
  7. version: '3.6'
  8. services:
  9. postgres:
  10. build:
  11. context: ./postgres
  12. dockerfile: Dockerfile
  13. ports:
  14. - 5435:5432
  15. volumes:
  16. - './postgres/pgdata:/var/lib/postgresql/data'
  17. # - './postgres/yourappdb.sql:/docker-entrypoint-initdb.d/yourappdb.sql'
  18. # - './postgres/init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh'
  19. environment:
  20. - POSTGRES_USER=myname
  21. - POSTGRESS_PASSWORD=test
  22. - POSTGRES_DATABASE=yourappdb
  23. api:
  24. build:
  25. dockerfile: Dockerfile.dev
  26. context: ./server
  27. volumes:
  28. - './server:/usr/src/app'
  29. ports:
  30. - 5001:5000
  31. environment:
  32. - FLASK_APP=server/index.py
  33. - FLASK_ENV=development
  34. - APP_SETTINGS=config.DevelopmentConfig
  35. - DATABASE_URL=postgres://myname:test@postgres:5432/yourappdb
  36. - DATABASE_TEST_URL=postgres://postgres:postgres@postgres:5432/yourappdb
  37. depends_on:
  38. - postgres
  39.  
  40. --
  41. -- PostgreSQL database dump
  42. --
  43.  
  44. -- Dumped from database version 9.6.5
  45. -- Dumped by pg_dump version 9.6.5
  46.  
  47. SET statement_timeout = 0;
  48. SET lock_timeout = 0;
  49. SET idle_in_transaction_session_timeout = 0;
  50. SET client_encoding = 'UTF8';
  51. SET standard_conforming_strings = on;
  52. SET check_function_bodies = false;
  53. SET client_min_messages = warning;
  54. SET row_security = off;
  55.  
  56. --
  57. -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
  58. --
  59.  
  60. CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
  61.  
  62.  
  63. --
  64. -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
  65. --
  66.  
  67. COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
  68.  
  69.  
  70. SET search_path = public, pg_catalog;
  71.  
  72. SET default_tablespace = '';
  73.  
  74. SET default_with_oids = false;
  75.  
  76. --
  77. -- Name: administrator; Type: TABLE; Schema: public; Owner: myname
  78. --
  79.  
  80. CREATE TABLE administrator (
  81. id integer NOT NULL,
  82. "timestamp" timestamp without time zone,
  83. email character varying(255)
  84. );
  85.  
  86.  
  87. ALTER TABLE administrator OWNER TO myname;
  88.  
  89. CREATE USER myname WITH PASSWORD 'test';
  90. CREATE DATABASE yourappdb;
  91. GRANT ALL PRIVILEGES ON DATABASE yourappdb TO myname;
  92. /c yourappdb;
Add Comment
Please, Sign In to add comment