Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to only one drocker compose file #7

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 6 additions & 3 deletions src/api/api.env → .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
UVICORN_HOST=0.0.0.0
UVICORN_PORT=8000

# Auth configuration
# API Auth configuration
ALGORITHM="HS256"
ACCESS_TOKEN_EXPIRATION = 60
CRYPT_CONTEXT_SCHEME="argon2"
Expand All @@ -11,9 +11,12 @@ CRYPT_CONTEXT_SCHEME="argon2"
AUTHORIZED_USERS ="root" # Do not put spaces between users


# Database Vars (!!! Critic Variables !!!)



# Database Vars
POSTGRES_HOST="bank_app_postgres"
POSTGRES_PORT=5432
POSTGRES_USER="root"
POSTGRES_PASSWORD= "root" # Define Postgres password here
POSTGRES_DB = 'bank_db'
POSTGRES_DB = 'bank_db'
28 changes: 13 additions & 15 deletions .github/workflows/upload_docker_images.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
# Version : 0.1.4
# Version : 0.1.5
# Current state : Dev
# Author : Guillaume Pot
# Contact : [email protected]


# Name of the workflow
name : Upload Docker images
name: Upload Docker images

# Trigger
on:
pull_request:
branches: ["main"]


# Jobs
jobs:
# Job - Push Streamlit image
Push and push Streamlit image:
push_streamlit_image:
name: Push Streamlit image
runs-on: ubuntu-latest
permissions:
contents: read
secrets: read

# Actions to execute
steps:
Expand All @@ -34,6 +30,12 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

# Get version from .env file
- name: Load .env file
uses: c-py/action-dotenv-to-setenv@v2
with:
env-file: .github/workflows/.env

# Build & Push Docker Image
- name: Build and push Docker Image
uses: docker/build-push-action@v2
Expand All @@ -43,14 +45,10 @@ jobs:
push: true
tags: Unclad3610/personal_bank_app_streamlit:${{ env.streamlit_version }}, Unclad3610/personal_bank_app_streamlit:latest



# Job - Push FastAPI image
Push and push FastAPI image:
push_fastapi_image:
name: Push FastAPI image
runs-on: ubuntu-latest
permissions:
contents: read
secrets: read

# Actions to execute
steps:
Expand All @@ -77,4 +75,4 @@ jobs:
context: ./src/api
file: ./src/api/Dockerfile
push: true
tags: Unclad3610/personal_bank_app_api:${{ env.api_version }}, Unclad3610/personal_bank_app_api:latest
tags: Unclad3610/personal_bank_app_api:${{ env.api_version }}, Unclad3610/personal_bank_app_api:latest
73 changes: 73 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Version : 0.2.1
# Current state : Prod
# Author : Guillaume Pot
# Contact : [email protected]


services:
# PostGres Container
container_postgres:
image: postgres:14
container_name: bank_app_postgres
env_file:
- .env
volumes:
- ../../storage/postgres_data:/var/lib/postgresql/data
ports:
- "${POSTGRES_PORT}:5432"
restart: on-failure
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 30s
timeout: 10s
retries: 3
networks:
- bank_app_network

# API Container
container_api:
image: Unclad3610/personal_bank_app_api:latest
container_name: bank_app_api
env_file:
- .env
ports:
- "8000:8000"
depends_on:
- serviceName: container_postgres
condition: service_healthy
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000"]
interval: 30s
timeout: 10s
retries: 3
networks:
- bank_app_network


# STREAMLIT Container
container_streamlit:
image: Unclad3610/personal_bank_app_streamlit:latest
container_name: bank_app_streamlit
environment:
- API_VERSION="0.2.0"
- API_URL="http://bank_app_api:8000"
ports:
- "8001:8001"
depends_on:
- serviceName: container_api
condition: service_healthy
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://container_api:8000"]
interval: 30s
timeout: 10s
retries: 3
networks:
- bank_app_network


# Networks
networks:
bank_app_network:
external: true
28 changes: 0 additions & 28 deletions src/api/docker-compose.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions src/postgres/docker-compose.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions src/postgres/postgres.env

This file was deleted.

27 changes: 0 additions & 27 deletions src/streamlit/docker-compose.yaml

This file was deleted.