Environment Variables:

Make sure to set the following environment variables in your Docker Compose file:

  • conn_string: This is the MySQL connection string required for EF Core for the main APIs.
  • Jwt_Exp_Dur: This is the expiration duration for the JWT token in minutes.
  • HANG_FIRE_CONN_STRING: This is the MySQL connection string required for EF Core for the Hangfire service.
  • Hangfire_User: This is the username for accessing the Hangfire dashboard.
  • Hangfire_Password: This is the password for accessing the Hangfire dashboard.
  • App_Url: This is the domain name for your application.
  • Image_url: This is the Docker image registry for the main application.

Ensure that you replace placeholders with actual values specific to your deployment environment.

Example Docker Compose Configuration:

version: "3.7"
services:
  reverseproxy:
    build:
      context: ./nginx
      dockerfile: Dockerfile
    ports:
      - "80:80"
      - "443:443"
    restart: always
  api:
    depends_on:
      - reverseproxy
    environment:
      ConnectionStrings__DefaultConnection: Server=Server;Database=Database_Name;User=Database_User;Password=Database_Password;Convert Zero Datetime=True;
      JWT__DurationInMinutes: Jwt_Exp_Dur
      ConnectionStrings__Hangfireconnection: Server=Server;Database=Database_Name;User=Database_User;Password=Database_Password;Convert Zero Datetime=True;Allow User Variables=True;
      Hangfire__User: Hangfire_User
      Hangfire__Password: Hangfire_Password
      AppUrls__App: App_Url
    image: Image_url
    expose:
      - "80"
    restart: always