diff --git a/Dockerfile b/Dockerfile index 761e85d..376af6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,5 +12,5 @@ COPY . ./ RUN npm run build FROM nginx -COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf -COPY --from=compile-image /opt/ng/dist/app-name /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=compile-image /app/dist /usr/share/nginx/html diff --git a/README.md b/README.md index 68c7062..d451c60 100644 --- a/README.md +++ b/README.md @@ -21,28 +21,46 @@ Webpack typescript starter with: - Ts-jest - Eslint -### [Demo](https://webpack-typescript-starter.netlify.app/) +## [Demo](https://webpack-typescript-starter.netlify.app/) -# Getting started +## Getting started -Make sure to have NodeJs already installed: +Make sure to have NodeJs already installed. -## Install all dependencies. +### Install all dependencies +```bash npm install +``` -## Start developing and serve your app: +### Start developing and serve your app +```bash npm start +``` -## Build your application: +### Build your application +```bash npm run build +``` -## Run unit tests: +### Run unit tests +```bash npm run test +``` -## Run coverage: +### Run coverage +```bash npm run coverage +``` + +### Docker + +Or simply run the example using docker: + +```bash +docker-compose up +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c0e5c2b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.5' +services: + front-application: + container_name: webpack-starter-container + build: + context: . + dockerfile: Dockerfile + volumes: + - '.:/usr/src/app' + ports: + - '4000:8080' diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..6489ae3 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,17 @@ +server { + + listen 8080; + + server_name localhost; + + root /usr/share/nginx/html; + + index index.html index.htm; + + location / { + + try_files $uri $uri/ /index.html; + + } + +}