diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d1e0ef4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,61 @@ +# ================================ +# Node and build output +# ================================ +node_modules +dist +out-tsc +.angular +.cache +.tmp + +# ================================ +# Testing & Coverage +# ================================ +coverage +jest +cypress +cypress/screenshots +cypress/videos +reports +playwright-report +.vite +.vitepress + +# ================================ +# Environment & log files +# ================================ +*.env* +!*.env.production +*.log +*.tsbuildinfo + +# ================================ +# IDE & OS-specific files +# ================================ +.vscode +.idea +.DS_Store +Thumbs.db +*.swp + +# ================================ +# Version control & CI files +# ================================ +.git +.gitignore + +# ================================ +# Docker & local orchestration +# ================================ +Dockerfile +Dockerfile.* +.dockerignore +docker-compose.yml +docker-compose*.yml + +# ================================ +# Miscellaneous +# ================================ +*.bak +*.old +*.tmp diff --git a/.npmrc b/.npmrc index 7adbeea..702d2bb 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ -@infinimotion:registry=https://git.infinimotion.de/api/packages/infinimotion/npm/ \ No newline at end of file +@infinimotion:registry=https://git.infinimotion.de/api/packages/infinimotion/npm/ +//git.infinimotion.de/api/packages/infinimotion/npm/:_authToken=584033e64beaef97ab111c86e90f956e89533b8c \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c8e5855 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +# ========================================= +# Stage 1: Build the Angular Application +# ========================================= +# ========================================= +# Stage 1: Build the Angular Application +# ========================================= +ARG NODE_VERSION=22.21.0-alpine +ARG NGINX_VERSION=alpine3.22 + +# Use a lightweight Node.js image for building (customizable via ARG) +FROM node:${NODE_VERSION} AS builder + +# Set the working directory inside the container +WORKDIR /app + +COPY .npmrc /root/.npmrc + +# Copy package-related files first to leverage Docker's caching mechanism +COPY package.json package-lock.json ./ + +# Install project dependencies using npm ci (ensures a clean, reproducible install) +RUN --mount=type=cache,target=/root/.npm npm ci + +# Copy the rest of the application source code into the container +COPY . . + +# Build the Angular application +RUN npm run build + +# ========================================= +# Stage 2: Prepare Nginx to Serve Static Files +# ========================================= + +FROM nginxinc/nginx-unprivileged:${NGINX_VERSION} AS runner + +# Use a built-in non-root user for security best practices +USER nginx + +# Copy custom Nginx config +COPY nginx.conf /etc/nginx/nginx.conf + +# Copy the static build output from the build stage to Nginx's default HTML serving directory +COPY --chown=nginx:nginx --from=builder /app/dist/*/browser /usr/share/nginx/html + +# Expose port 8080 to allow HTTP traffic +# Note: The default NGINX container now listens on port 8080 instead of 80 +EXPOSE 7200 + +# Start Nginx directly with custom config +ENTRYPOINT ["nginx", "-c", "/etc/nginx/nginx.conf"] +CMD ["-g", "daemon off;"] \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..1ea411d --- /dev/null +++ b/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +podman build -t git.infinimotion.de/infinimotion/frontend:latest . +podman push git.infinimotion.de/infinimotion/frontend:latest diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..56f19be --- /dev/null +++ b/nginx.conf @@ -0,0 +1,43 @@ +worker_processes auto; + +pid /tmp/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # Logging + access_log off; + error_log /dev/stderr warn; + + # Performance + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + keepalive_requests 1000; + + # Compression + gzip off; + + server { + listen 7200; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location ~ ^/api { + proxy_pass http://backend:7080; + } + + } +} diff --git a/src/app/poc-model-component/poc-model-component.ts b/src/app/poc-model-component/poc-model-component.ts index 81479ca..81c85f7 100644 --- a/src/app/poc-model-component/poc-model-component.ts +++ b/src/app/poc-model-component/poc-model-component.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { Eintrittskarte, Kinosaal, Vorstellung } from '@InfiniMotion/model-frontend'; +import { Eintrittskarte, Kinosaal, Vorstellung } from '@infinimotion/model-frontend'; @Component({ selector: 'app-poc-model-component',