From 96b86095af98d738fcc7d861bd30373e384f3dd5 Mon Sep 17 00:00:00 2001 From: iptoux Date: Sat, 5 Apr 2025 10:23:02 +0200 Subject: [PATCH 1/8] Add Docker support and update project metadata Introduced Docker support with a Dockerfile and docker-compose.yml to streamline containerization. Updated `package-lock.json` metadata, including the project name and version. These changes enhance deployment consistency and simplify the development process. --- Dockerfile | 47 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 16 ++++++++++++++++ package-lock.json | 8 ++++---- 3 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..31d2236 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,47 @@ +FROM FROM node:23.9.0-bullseye +LABEL authors="iptoux" + +# Setze das Arbeitsverzeichnis im Container +WORKDIR /app + +# Installiere Git und bereinige den apt-Cache in einem einzigen Layer +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y git && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Installiere Angular CLI global +RUN npm install -g @angular/cli + +# Klone das Repository +RUN git clone https://github.com/iptoux/AngularTasks + +# Setze das Arbeitsverzeichnis auf das Angular-Projekt +WORKDIR /app/AngularTasks + +RUN npm install + +# Erstelle das Start-Skript während des Builds +RUN cat << 'EOF' > start-servers.sh +#!/bin/bash + +# Starte den Webhook-Server im Hintergrund +cd /app/AngularTasks +node updater.js & + +# Warte kurz, damit der Webhook-Server starten kann +sleep 2 + +# Starte den Angular-Server +ng serve --host 0.0.0.0 --disable-host-check --poll 2000 +EOF + +# Mache das Start-Skript ausführbar +RUN chmod +x start-servers.sh + +# Exponiere die Ports +EXPOSE 4200 + +# Setze den Standardbefehl +CMD ["./start-servers.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7abe48e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3.8' + +services: + angular_tasks: + build: . + hostname: angular-tasks + ports: + - "4200:4200" + volumes: + - angular_node_modules:/app/AngularTasks/node_modules + environment: + - NODE_ENV=production + restart: unless-stopped + +volumes: + angular_node_modules: diff --git a/package-lock.json b/package-lock.json index da7a8ae..3e58a98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "untitled1", - "version": "0.0.0", + "name": "mytaskapplication", + "version": "1.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "untitled1", - "version": "0.0.0", + "name": "mytaskapplication", + "version": "1.3.3", "dependencies": { "@angular/cdk": "^19.2.4", "@angular/common": "^19.2.0", From d9aac0f71d8bce6c883bb73f0a3c0ec300a99b87 Mon Sep 17 00:00:00 2001 From: iptoux Date: Sat, 5 Apr 2025 10:23:22 +0200 Subject: [PATCH 2/8] Fix redundant 'FROM' in Dockerfile Removed the duplicate 'FROM' statement to ensure the Dockerfile complies with syntax requirements and avoids build errors. This change improves clarity and ensures proper Docker image initialization. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 31d2236..0d05bf7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM FROM node:23.9.0-bullseye +FROM node:23.9.0-bullseye LABEL authors="iptoux" # Setze das Arbeitsverzeichnis im Container From 430dd278518d3adb81ce7dbae2c4121b7ccc3b6e Mon Sep 17 00:00:00 2001 From: iptoux Date: Sat, 5 Apr 2025 10:27:37 +0200 Subject: [PATCH 3/8] Simplify start-servers.sh creation process in Dockerfile Replaced `cat` syntax for creating start-servers.sh to improve clarity and consistency. This change ensures the script is handled correctly during the build process. --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0d05bf7..3f7c888 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,8 @@ WORKDIR /app/AngularTasks RUN npm install # Erstelle das Start-Skript während des Builds -RUN cat << 'EOF' > start-servers.sh +RUN <<'EOF' cat > + start-servers.sh #!/bin/bash # Starte den Webhook-Server im Hintergrund From 97d10ba75e8cf5d84f67d943451a2a250b83ee53 Mon Sep 17 00:00:00 2001 From: iptoux Date: Sat, 5 Apr 2025 10:28:56 +0200 Subject: [PATCH 4/8] Refactor Dockerfile to simplify server startup script. Removed unnecessary background Webhook-Server startup and sleep delay. Focused on directly starting the Angular server to streamline the process and improve efficiency. --- Dockerfile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3f7c888..cbc5ed0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,15 +26,7 @@ RUN npm install RUN <<'EOF' cat > start-servers.sh #!/bin/bash - -# Starte den Webhook-Server im Hintergrund cd /app/AngularTasks -node updater.js & - -# Warte kurz, damit der Webhook-Server starten kann -sleep 2 - -# Starte den Angular-Server ng serve --host 0.0.0.0 --disable-host-check --poll 2000 EOF From db3f7c3aeaa71d3af309adde111ec71e42b82c16 Mon Sep 17 00:00:00 2001 From: iptoux Date: Sat, 5 Apr 2025 10:31:10 +0200 Subject: [PATCH 5/8] Refactor startup script handling in Docker setup Replaced inline creation of the startup script with a copied `entrypoint.sh` file for improved clarity and maintainability. Adjusted Dockerfile commands accordingly to use the new script. --- Dockerfile | 12 +++--------- entrypoint.sh | 3 +++ 2 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index cbc5ed0..cc7a54a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,19 +22,13 @@ WORKDIR /app/AngularTasks RUN npm install -# Erstelle das Start-Skript während des Builds -RUN <<'EOF' cat > - start-servers.sh -#!/bin/bash -cd /app/AngularTasks -ng serve --host 0.0.0.0 --disable-host-check --poll 2000 -EOF +COPY entrypoint.sh . # Mache das Start-Skript ausführbar -RUN chmod +x start-servers.sh +RUN chmod +x entrypoint.sh # Exponiere die Ports EXPOSE 4200 # Setze den Standardbefehl -CMD ["./start-servers.sh"] +CMD ["./entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..40b20ab --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd /app/AngularTasks +ng serve --host 0.0.0.0 --disable-host-check --poll 2000 From b933e6a2877242441c4f1be65cc7661a7264946a Mon Sep 17 00:00:00 2001 From: iptoux Date: Sat, 5 Apr 2025 10:34:27 +0200 Subject: [PATCH 6/8] Use `npx` to run Angular CLI in entrypoint script. Replaced the direct `ng` command with `npx ng` to ensure compatibility with local Angular CLI installations. Added background execution for the development server to prevent blocking the script flow. --- entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 40b20ab..9e49422 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,4 @@ #!/bin/bash cd /app/AngularTasks -ng serve --host 0.0.0.0 --disable-host-check --poll 2000 +#ng serve --host 0.0.0.0 --disable-host-check --poll 2000 +npx ng serve --host 0.0.0.0 --disable-host-check --poll 2000 & From 6b979820f0cdd67c36b72da1d1918e305acc7670 Mon Sep 17 00:00:00 2001 From: iptoux Date: Sat, 5 Apr 2025 10:35:57 +0200 Subject: [PATCH 7/8] Remove deprecated '--disable-host-check' flag from ng serve The '--disable-host-check' flag has been deprecated and is no longer necessary. This change ensures compatibility with the latest Angular CLI versions while maintaining functionality. --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9e49422..d5cdab5 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ #!/bin/bash cd /app/AngularTasks #ng serve --host 0.0.0.0 --disable-host-check --poll 2000 -npx ng serve --host 0.0.0.0 --disable-host-check --poll 2000 & +npx ng serve --host 0.0.0.0 --poll 2000 & From 59fbb66ca1c161346ba4651d5aa4eb96f43ea2ba Mon Sep 17 00:00:00 2001 From: Maik Damm Date: Sat, 5 Apr 2025 10:37:58 +0200 Subject: [PATCH 8/8] Bump version to 1.3.5 Update package.json to reflect the new version. This ensures version tracking aligns with recent changes or updates in the codebase. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d40ae94..bc7a3dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mytaskapplication", - "version": "1.3.3", + "version": "1.3.5", "main": "app.js", "scripts": { "ng": "ng",