How to run a docker-compose of front-end and back-end in Web Services?

Николоски Благоја 0 Reputation points
2024-07-17T17:12:37.02+00:00
version: '3.8'

services:
  backend:
    image: blagojanikoloski/firesmk-backend:latest
    container_name: firesmk-backend
    ports:
      - "8080:8080"

  frontend:
    image: blagojanikoloski/firesmk-frontend:latest
    container_name: firesmk-frontend
    ports:
      - "80:80"


I have set up an App Services using docker-compose file that pulls 2 images from Docker Hub. One is my back-end, One is my front-end. Locally, this works great. My front-end is available at localhost:80, and my back-end at localhost:8080. However, when I try to access the myapp.azurewebsites.net link, I get error 404. Surprisingly, if I acess myapp.azurewebsites.net/controller/method, IT WORKS. How do I get the frontend to work at just myapp.azurewebsites.net? Here is my docker-compose.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,890 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 26,471 Reputation points Microsoft Employee
    2024-07-25T05:36:01.56+00:00

    Николоски Благоја, Firstly, apologies for the delayed response.

    Based on my understanding of your scenario, you may look at these approaches outlined by my colleague, in this discussion thread:

    https://learn.microsoft.com/answers/questions/1359811/how-to-secure-frontend-app-service-calling-a-backe

     

    • If the only public access is via the UI/Front end app and that app is "virtual network integrated" then the other apps can be access over a private endpoint and the access through the public endpoint for those other apps can be turned off.
    • You have the option of using either Azure Front Door or Application Gateway which both have a Web-Application-Firewall (WAF) feature, if you need that extra layer of functionality in front of your apps. If you did then it would be possible to broker public access to the front end / UI through either Front Door or Application Gateway and have the rest of the network path private

     

    Kindly take a look at these reference docs:

     

    Just to highlight, on custom container for Azure App Service, the following Docker Compose configuration options are unsupported.

    Azure doc | Configure a custom container for Azure App Service | Unsupported options

    • build (not allowed)
    • depends_on (ignored)
    • networks (ignored)
    • secrets (ignored)
    • ports other than 80 and 8080 (ignored)
    • default environment variables like $variable and ${variable} unlike in docker

    Kindly let us know, I'll follow-up with you further.


    If the answer helped (pointed, you in the right direction) > please click Accept Answer - it will benefit community members to find the answers quickly. 

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.