From 9b58aaaa0b200ca926ffc837b586bbd4ac81a524 Mon Sep 17 00:00:00 2001 From: sebastian Date: Mon, 3 Aug 2026 14:14:20 +0200 Subject: [PATCH] ADD: Dockerize --- Dockerfile | 13 +++++++++++++ nginx.conf | 9 +++++++++ src/app/app.config.ts | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0112edb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +# Stage 1: Build +FROM node:26-alpine AS build +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build -- --configuration production + +# Stage 2: Serve +FROM nginx:alpine +COPY --from=build /app/dist/WetterHub/browser /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..f749e02 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,9 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } +} diff --git a/src/app/app.config.ts b/src/app/app.config.ts index 51c545c..bd8381a 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -7,7 +7,7 @@ import {Configuration} from './api'; export function apiConfigFactory() { return new Configuration({ - basePath: 'http://localhost:8000' + basePath: `${window.location.protocol}//${window.location.hostname}:8000` }); }