I create the following docker image
# Stage 0, "build-stage", based on Node.js, to build and compile the frontend FROM tiangolo/node-frontend:10 as build-stage WORKDIR /app COPY package*.json /app/ RUN npm install COPY ./ /app/ RUN CI=true npm test RUN npm run build # Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx FROM nginx:1.15 COPY --from=build-stage /app/build/ /usr/share/nginx/html # Copy the default nginx.conf provided by tiangolo/node-frontend COPY ./nginx.conf /etc/nginx/conf.d/v2.myapp.io
Where the nginx.conf is
server { listen 80; server_name serverip v2.myapp.io www.v2.myapp.io; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html =404; } include /etc/nginx/extra-conf.d/*.conf; }
And then i execute the following sh
docker build -t mycontainer . docker push mycontainer:latest ssh root@ip 'docker pull mycontainer:latest' ssh root@ip 'docker stop mycontainer' ssh root@ip 'docker rm mycontainer' ssh root@ip 'sudo docker run -p 8080:80 -it -d --name mycontainer mycontainer'
Well it works fine, but the address v2.myapp.io points to a blank nginx page, so i guess i have some sort of missconfiguration. But im not sure what else can be happening
Can someone help with this issue?
I remember that when I used to do all this manually, I had a sites-enabled, and a sites-available folder, i have tried creating them and puting the nginx.conf file in but i had no luck
What is failing there?
https://stackoverflow.com/questions/66701234/trying-to-setup-a-docker-autodeploy-to-my-server-but-nginx-image-is-not-showing March 19, 2021 at 09:05AM
没有评论:
发表评论