I want to build a container for my web app.
I would like to provide the frontend from my /dist folder and run the nodejs backend.
via nginx I want to handle my requests.
this is my Dockerfile:
FROM osixia/light-baseimage:1.1.1 # install node RUN apt-get update && apt-get install curl -y RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - RUN apt-get update && apt-get upgrade -y && apt-get install nodejs -y RUN apt-get update && apt-get upgrade -y && \ apt-get install -y nodejs \ npm # install nginx RUN apt-get update && apt-get install -y nginx # configure nginx WORKDIR /etc/nginx/sites-enabled RUN rm default COPY default.conf . # restart nginx RUN service nginx restart WORKDIR /app COPY . . WORKDIR /app/backend RUN npm i EXPOSE 8000 CMD ["npm", "start"]
everything works fine, except it seems like the ‘RUN service nginx restart‘ is not working properly as I can’t access the page after starting the container.
After accessing the container and executing ‘service nginx restart’ manually, everything works fine
Does anybody know what could be the reason for that?