Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # base image
- FROM postgres:10.4-alpine
- # run the db file on init
- ADD yourappdb.sql /docker-entrypoint-initdb.d
- version: '3.6'
- services:
- postgres:
- build:
- context: ./postgres
- dockerfile: Dockerfile
- ports:
- - 5435:5432
- volumes:
- - './postgres/pgdata:/var/lib/postgresql/data'
- # - './postgres/yourappdb.sql:/docker-entrypoint-initdb.d/yourappdb.sql'
- # - './postgres/init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh'
- environment:
- - POSTGRES_USER=myname
- - POSTGRESS_PASSWORD=test
- - POSTGRES_DATABASE=yourappdb
- api:
- build:
- dockerfile: Dockerfile.dev
- context: ./server
- volumes:
- - './server:/usr/src/app'
- ports:
- - 5001:5000
- environment:
- - FLASK_APP=server/index.py
- - FLASK_ENV=development
- - APP_SETTINGS=config.DevelopmentConfig
- - DATABASE_URL=postgres://myname:test@postgres:5432/yourappdb
- - DATABASE_TEST_URL=postgres://postgres:postgres@postgres:5432/yourappdb
- depends_on:
- - postgres
- --
- -- PostgreSQL database dump
- --
- -- Dumped from database version 9.6.5
- -- Dumped by pg_dump version 9.6.5
- SET statement_timeout = 0;
- SET lock_timeout = 0;
- SET idle_in_transaction_session_timeout = 0;
- SET client_encoding = 'UTF8';
- SET standard_conforming_strings = on;
- SET check_function_bodies = false;
- SET client_min_messages = warning;
- SET row_security = off;
- --
- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
- --
- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
- --
- -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
- --
- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
- SET search_path = public, pg_catalog;
- SET default_tablespace = '';
- SET default_with_oids = false;
- --
- -- Name: administrator; Type: TABLE; Schema: public; Owner: myname
- --
- CREATE TABLE administrator (
- id integer NOT NULL,
- "timestamp" timestamp without time zone,
- email character varying(255)
- );
- ALTER TABLE administrator OWNER TO myname;
- CREATE USER myname WITH PASSWORD 'test';
- CREATE DATABASE yourappdb;
- GRANT ALL PRIVILEGES ON DATABASE yourappdb TO myname;
- /c yourappdb;
Add Comment
Please, Sign In to add comment