I
I
Innokenty Ivanov2018-11-06 17:44:09
Nginx
Innokenty Ivanov, 2018-11-06 17:44:09

How to Provision a Container for Microsoft Azure App Service?

Somehow I got a lyam for Azhur's services. Well, I think, let's deploy Docker.
Dockerfile

FROM node:latest AS buildContainer

COPY . /app
WORKDIR /app
# Copy dependency definitions
RUN npm install
RUN npm run build

FROM nginx:latest
RUN apt-get update 

COPY nginx.conf /etc/nginx/nginx.conf
COPY gzip.conf /etc/nginx/gzip.conf
COPY mime.types /etc/nginx/mime.types

COPY --from=buildContainer /app/dist/ /usr/share/nginx/html

EXPOSE 9000/tcp

nginx.conf
user  nginx;
worker_processes 4;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
  worker_connections 1024;
}


http {
    log_format gzip '[$time_local] ' '"$request" $status $bytes_sent';

    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    access_log /dev/stdout;
    charset utf-8;
   
    sendfile        on;
    keepalive_timeout  65;

    #include /etc/nginx/conf.d/*.conf;

    server {
        listen       9000;
        server_name  localhost;

        access_log /dev/stdout;

        root /usr/share/nginx/html;

        location / {
            try_files $uri$args $uri$args/ /index.html;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
          root   /usr/share/nginx/html;
        }

    }
    # Compression
    include       /etc/nginx/gzip.conf;
}

It seems to be clear - I exposed the 9000 port, we go through it, and the application on the Node stirs up (that is, renders) the initial page, and then everything follows Angular. And nothing happens when you visit the desired URL!
Here is the log when starting the container (it does not give any errors):
2018_11_06_RD0004FFB31D38_default_docker.log:
2018_11_06_RD0004FFB31D38_docker.log:
864b622b8d82: Pull complete
c1...b8: Pull complete
58...91: Pull complete
ac...24: Pull complete
Digest: sha256:04...ac
Status: Downloaded newer image for someaccount/somecontainer:latest

2018-11-06 14:31:21.723 INFO  - Starting container for site
2018-11-06 14:31:21.723 INFO  - docker run -d -p 9303:80 --name someaccount_0 -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=someaccount -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=6f...48 -e HTTP_LOGGING_ENABLED=1 someaccount/somecontainer:latest

Can't login via SSH - EHOSTUNREACH.
What could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question