diff --git a/testContainerAngular/.dockerignore b/testContainerAngular/.dockerignore new file mode 100644 index 0000000..de4d1f0 --- /dev/null +++ b/testContainerAngular/.dockerignore @@ -0,0 +1,2 @@ +dist +node_modules diff --git a/testContainerAngular/Dockerfile b/testContainerAngular/Dockerfile new file mode 100644 index 0000000..b4f2d21 --- /dev/null +++ b/testContainerAngular/Dockerfile @@ -0,0 +1,17 @@ +FROM node:8.11.2-alpine as node + +WORKDIR /usr/src/app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + +FROM nginx:1.13.12-alpine + +COPY --from=node /usr/src/app/dist /usr/share/nginx/html + +COPY ./nginx.conf /etc/nginx/conf.d/default.conf diff --git a/testContainerAngular/docker-compose.yml b/testContainerAngular/docker-compose.yml new file mode 100644 index 0000000..5770d35 --- /dev/null +++ b/testContainerAngular/docker-compose.yml @@ -0,0 +1,17 @@ +version: '2.3' + +services: + angular: + hostname: localhost + container_name: angular-container + build: . + ports: + - 8080:8080 + + nginx: + container_name: nginx-container + image: nginx:1.13.12-alpine + volumes: + - ./nginx_proxy.conf:/etc/nginx/conf.d/default.conf + ports: + - "80:80" diff --git a/testContainerAngular/nginx.conf b/testContainerAngular/nginx.conf new file mode 100644 index 0000000..8c6ac82 --- /dev/null +++ b/testContainerAngular/nginx.conf @@ -0,0 +1,8 @@ +server { + listen 8080; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html =404; + } +} diff --git a/testContainerAngular/nginx_proxy.conf b/testContainerAngular/nginx_proxy.conf new file mode 100644 index 0000000..cc77c66 --- /dev/null +++ b/testContainerAngular/nginx_proxy.conf @@ -0,0 +1,7 @@ +server { + listen 80; + server_name localhost; + location / { + proxy_pass http://angular:8080/; + } +}