diff --git a/Dockerfile b/Dockerfile index 1456808..cdd08e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,9 @@ -FROM node:alpine +FROM nginx:alpine -WORKDIR /usr/src/app +COPY ./dist/review-front/browser /usr/share/nginx/html -COPY . /usr/src/app +COPY ./nginx.conf /etc/nginx/conf.d/default.conf -RUN npm install -g @angular/cli -RUN npm install +EXPOSE 80 -CMD ["ng", "serve", "--host", "0.0.0.0"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index 39f6c5e..5a39077 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,13 @@ - [ ] Terminer l'interface admin - [x] Bug (de temps en temps) pour stocker les données utilisateur +avant de run le docker +``` +npm i +ng build --configuration=production +``` pour run le docker : ``` -sudo docker build -t abonentendeur . -sudo docker run -d -p 4200:4200 abonentendeur +sudo docker build -t abonentendeur-prod . +sudo docker run -d -p 4200:80 abonentendeur-prod ``` diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..5c4e1cf --- /dev/null +++ b/nginx.conf @@ -0,0 +1,13 @@ +server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html index.htm; + + location / { + try_files $uri $uri/ /index.html; + } + + error_page 404 /index.html; +}