soat-fiap / FIAP.TechChallenge.ByteMeBurger

Repository for FIAP SOAT post degree Tech Challenge
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Configure Docker compose file to run application #10

Closed italopessoa closed 1 month ago

italopessoa commented 2 months ago

Is your feature request related to a problem? Please describe. The application needs to be executed on different environments where configuration and dependencies might not be available, for that it needs to be shipped with all dependencies required out of the box

Describe the solution you'd like Docker compose file configured to run the database and API on an isolated environment

Sample

services: 
  api:
    depends_on: 
      - database
    container_name: webapicontainer
    build:
      context: ./
      dockerfile: WebApplication1/Dockerfile
      tags:
        - newwebapi
    restart: always
    networks: 
      - tech-challenge
    ports:
      - 8080:8080
    environment:
      - MongoSettings__Username=usernamedocker2
      - MongoSettings__Password=passworddocker
      - MongoSettings__Database=databasedocker
      - MongoSettings__Port=27017

  database:
    image: mongo
    restart: always
    environment:
      - MONGO_INITDB_ROOT_USERNAME=root
      - MONGO_INITDB_ROOT_PASSWORD=example
    networks:
      - tech-challenge
    ports:
      - 27017:27017

networks:
  tech-challenge:
    driver: bridge