Starting docker application on azure app Service

Arhanti Doshi 65 Reputation points
2024-10-24T04:02:18.01+00:00

I have dockarized my application. It needs nginx to start. Front end is Angular and backend is Java spring boot. I am using spring security

I want to use azure app service to start my application.

  1. how can i access my application with url provided by azure app service?
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,972 questions
Azure | Azure Startups
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2024-10-25T20:46:06.8533333+00:00

    Thanks for the additional info.

    Please enable and review logs to fetch more details about the error and let us know: #enable-application-logging-linuxcontainer and Access log files

    By default, App Service assumes your custom container is listening on port 80.

    If you’re running a (custom container) with Web App for Containers, use WEBSITES_PORT. Ensure that this is set to the port that’s also exposed in your Dockerfile through the EXPOSE instruction Vs On App Service Linux, using (Blessed Images) - use PORT, which directly influences the container port of the docker run command.

    Ensure that your application is listening on the correct port. In your Dockerfile, you have EXPOSE Ports', make sure these ports are correctly configured in your application code and match the ports exposed in the Dockerfile.

    1 person found this answer helpful.
    0 comments No comments

  2. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2024-10-24T08:31:21.1833333+00:00

    Arhanti Doshi, To better assist you on this, are you provisioning the container image via ACR? Are you referring to this Azure doc for the steps?  Are you deploying via GitHub Actions or Azure Devops?

     

    Based on my understanding of your scenario description, just to highlight, when you create production build for your Angular or other Node framework the files will either be placed in a build or dist directory depending on the framework.

    App Service on Linux uses Oryx to detect, build, and start your application.

     

    Where frontend contains your Angular project. Outside of frontend is the backend (eg., server.js.)

    1. cd into the frontend folder, or the folder containing your SPA, and run npm run build (or yarn run build).
    2. The output from this should be a /build folder under your frontend directory (in React’s case) - using Angular or others may produce a folder named /dist.

    o You can run this folder directly to test with something like npx serve -s build.

    3.Update your backend to reflect your front end production builds location

    Take a look at the sample frontend-backend-spa-node-example from my colleague you can employ a similar approach for your Angular app.

    • Run npm run build
    • Run npm run start

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


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.