Skip to content

Latest commit

 

History

History
56 lines (48 loc) · 1.31 KB

README.org

File metadata and controls

56 lines (48 loc) · 1.31 KB

Simple blog app

Simple blog app utility to test FastAPI library and Docker functionalities

Docker testing

  • Building blog-app image
    docker build -t blogg .
        
  • Running blog app
    docker run -p 8000:8000 --network host blogg
        
  • Launching Postgres database
    docker run --name postgres-blog -e POSTGRES_PASSWORD="" \
        -p 5432:5432 --network host -d postgres
        
  • Creating database blog
    docker exec -it postgres-blog /bin/bash
    # On the container:
    psql -h localhost -p 5432 -U postgres -W
    # On pgsql shell
    create database blog;
    \q
    exit
        

Docker compose

docker-compose -f docker-compose.yaml up --build

Current Steps

As I’m perfecting this, the steps are quite annoying

  1. User docker-compose
    docker-compose -f docker-compose.yaml up --build
        
  2. Above step will fail the first time. Manually enter the postgres-blog container to create the database
    docker exec -it postgres-blog /bin/bash
    # On the container:
    psql -h localhost -p 5432 -U postgres -W
    # On pgsql shell
    create database blog;
    \q
    exit
        
  3. Run docker compose again. It should be ready