From 18d9498579a1deb0ee0d00ad7d08c37bbb5f498a Mon Sep 17 00:00:00 2001 From: Sergio Date: Thu, 20 Apr 2023 16:42:46 +0200 Subject: [PATCH 1/4] Added docker deployment files. Updated README.md with Docker deployment steps. --- .dockerignore | 9 +++++++++ Dockerfile | 17 +++++++++++++++++ README.md | 19 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..deaa5dbd --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.git +.gitignore +node_modules +.editorconfig +LICENSE +*.md +Dockerfile* +docker-compose* +.vscode diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..c3f290fd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:14 + +WORKDIR /app + +COPY package.json . + +RUN npm update +RUN npm install + +COPY . . + +RUN npm run build --prod + +EXPOSE 4200 + +# Start APP +CMD npm start diff --git a/README.md b/README.md index abfa1913..d0cf65a4 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,25 @@ To install ngx-admin you have to use NodeJS version 14.14+ because of [node-sass](https://github.com/sass/node-sass) version utilized in the application. +### Docker deployment + +For deployment using Docker containers, please use the Dockerfile provided. + +Example for local deployment: + +First, build the image +```bash +cd /path/to/projectfolder +docker build -t akveo/ngx-admin:starter-kit-10 . +``` + +And then run the container +```bash +docker run -dt -v /path/to/projectfolder/src:/app/src --name ngx-admin -p 4200:4200 akveo/ngx-admin:starter-kit-10 +``` + +Finally, wait for a few seconds to let the container init (you can check with `docker logs -f ngx-admin`) and then you can open your browser on http://localhost:4200/. + # Material theme for ngx-admin Material admin theme is based on the most popular Angular dashboard template - [ngx-admin](https://akveo.github.io/ngx-admin?utm_campaign=ngx_admin%20-%20home%20-%20ngx_admin%20github%20readme&utm_source=ngx_admin_material&utm_medium=referral&utm_content=github_readme) From 5811a1c71cc73c18dc82be3ad97697d549d2a4df Mon Sep 17 00:00:00 2001 From: Sergio Date: Thu, 20 Apr 2023 16:47:37 +0200 Subject: [PATCH 2/4] Fixed error in Docker image tag --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d0cf65a4..14af5f91 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ Example for local deployment: First, build the image ```bash cd /path/to/projectfolder -docker build -t akveo/ngx-admin:starter-kit-10 . +docker build -t akveo/ngx-admin . ``` And then run the container ```bash -docker run -dt -v /path/to/projectfolder/src:/app/src --name ngx-admin -p 4200:4200 akveo/ngx-admin:starter-kit-10 +docker run -dt -v /path/to/projectfolder/src:/app/src --name ngx-admin -p 4200:4200 akveo/ngx-admin ``` Finally, wait for a few seconds to let the container init (you can check with `docker logs -f ngx-admin`) and then you can open your browser on http://localhost:4200/. From be967612eabf6c97459401ac4c9c6dfaeb727064 Mon Sep 17 00:00:00 2001 From: Sergio Date: Thu, 20 Apr 2023 17:39:54 +0200 Subject: [PATCH 3/4] Disable CLI analytics for allowing Docker deployment If it is enabled, when executing the `docker run` command, it asks for Angular analytics and the container never inits. --- angular.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/angular.json b/angular.json index 0fe52748..7612c661 100644 --- a/angular.json +++ b/angular.json @@ -181,5 +181,8 @@ "@schematics/angular:directive": { "prefix": "ngx" } + }, + "cli": { + "analytics": false } } From 734a3a8976b25fbf7631069fdaa83742e286278d Mon Sep 17 00:00:00 2001 From: Sergio Date: Fri, 21 Apr 2023 22:48:19 +0200 Subject: [PATCH 4/4] Remove update command Removed `npm update` command. --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c3f290fd..f6ae3bd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ WORKDIR /app COPY package.json . -RUN npm update RUN npm install COPY . .