vendredi 23 mars 2018

Angular app + NGINX + Docker

I have problem with serving angular app using nginx on docker. Problem is only when I want to turn on SLL on site. I'm using bamboo to deployment.

Here is my dockerfile:

FROM node:8.6 as node
WORKDIR /app
COPY package.json /app/
COPY ssl/certificate.crt /app/
COPY ssl/ /app/ssl

RUN npm install -g @angular/cli --unsafe
RUN npm install

COPY ./ /app/
RUN ng build --prod --aot=false --env=prod

FROM nginx

RUN mkdir -p /ssl
COPY --from=node /app/ssl/ /ssl/
ADD ssl/certificate.crt /etc/nginx/certs/
ADD ssl/private.key /etc/nginx/certs/
RUN ls /etc/nginx/certs/

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

RUN ls /usr/share/nginx/html

Script to run:

docker build -t test-app .
docker run --name test-app-cont -v /etc/nginx/certs:/etc/nginx/certs -d -p 3010:443 test-app

Deployment runs successfully, but there is no app on server served.

Please have a look on this screen: There is listed what is on /certs and /html. Everything seems to be good.

enter image description here

If I remove this lines dedicated to SSL, everything is going fine, and on server I can see my app, but only on http.

The certificates are valid, I checked.

What I'm doing wrong?




Aucun commentaire:

Enregistrer un commentaire