Compare commits

...

16 Commits

Author SHA1 Message Date
steinhelge 58b5ff9852 Merge pull request 'dev' (#4) from dev into master
Build & Push Hospitality / build-and-push (push) Successful in 4m44s
Reviewed-on: #4
2025-11-26 08:58:24 +00:00
steinhelge 68ecdb0056 feat: Add Nginx configuration for SPA routing and static asset caching.
Build & Push Hospitality / build-and-push (push) Successful in 3m43s
2025-11-25 20:10:47 +01:00
steinhelge bde8e8bedc feat: Integrate Traefik for API and web routing with TLS, updating build workflow to use new HTTPS API endpoints.
Build & Push Hospitality / build-and-push (push) Successful in 3m41s
2025-11-25 20:00:54 +01:00
steinhelge 07af11b541 refactor: move REGISTRY environment variable to job scope and correct step indentation.
Build & Push Hospitality / build-and-push (push) Successful in 2m10s
2025-11-25 19:51:35 +01:00
steinhelge bdfdcbe0f7 Update .gitea/workflows/build.yml 2025-11-25 18:30:14 +00:00
steinhelge 16864584e4 Update .gitea/workflows/build.yml 2025-11-25 18:29:28 +00:00
steinhelge a5ec63b064 Merge pull request 'feat: Configure VITE_API_URL during build via Gitea workflow and Dockerfile, removing local fallback.' (#3) from master into dev
Build & Push Hospitality / build-and-push (push) Successful in 3m40s
Reviewed-on: #3
2025-11-25 18:27:38 +00:00
steinhelge bd64eea849 feat: Configure VITE_API_URL during build via Gitea workflow and Dockerfile, removing local fallback.
Build & Push Hospitality / build-and-push (push) Successful in 3m41s
2025-11-25 19:22:56 +01:00
steinhelge a298159ce2 Update .gitea/workflows/build.yml
Build & Push Hospitality / build-and-push (push) Successful in 2m1s
2025-11-25 12:21:49 +00:00
steinhelge 7ae6871f1c Merge pull request 'Update .gitea/workflows/build.yml' (#1) from steinhelge-patch-1 into master
Reviewed-on: #1
2025-11-25 12:18:41 +00:00
steinhelge 030f1d8b49 Merge pull request 'Update src/Hospitality.Backend/Dockerfile' (#2) from steinhelge-patch-2 into master
Build & Push Hospitality / build-and-push (push) Failing after 14s
Reviewed-on: #2
2025-11-25 12:18:26 +00:00
steinhelge 4a055b5cde Update src/Hospitality.Backend/Dockerfile 2025-11-25 12:17:01 +00:00
steinhelge 77a795ddcc Update .gitea/workflows/build.yml 2025-11-25 12:13:51 +00:00
steinhelge f6243ba5ba refactor: Remove unused Badge import from ScannerPage.tsx
Build & Push Hospitality / build-and-push (push) Failing after 4m4s
2025-11-24 11:47:41 +01:00
steinhelge 8a464aebf4 Merge branch 'master' of https://gitea.theriise.net/steinhelge/hospitality
Build & Push Hospitality / build-and-push (push) Failing after 49s
2025-11-24 11:43:35 +01:00
steinhelge 011434ba56 feat: Add Docker Compose configurations for development and production environments and update TypeScript compiler options. 2025-11-24 11:43:31 +01:00
9 changed files with 204 additions and 24 deletions
+32 -4
View File
@@ -7,12 +7,11 @@ on:
- dev - dev
env:
REGISTRY: gitea.theriise.net/steinhelge
jobs: jobs:
build-and-push: build-and-push:
runs-on: self-hosted runs-on: self-hosted
env:
REGISTRY: gitea.theriise.net/steinhelge
steps: steps:
- name: Checkout - name: Checkout
@@ -45,7 +44,14 @@ jobs:
# ---------- Frontend ---------- # ---------- Frontend ----------
- name: Build Frontend (${{ env.TAG }}) - name: Build Frontend (${{ env.TAG }})
run: | run: |
if [ "$TAG" = "dev" ]; then
API_URL="https://hospitality-dev-api.theriise.net/api"
else
API_URL="https://hospitality-api.theriise.net/api"
fi
docker build \ docker build \
--build-arg VITE_API_URL=$API_URL \
-t $REGISTRY/hospitality-frontend:${TAG} \ -t $REGISTRY/hospitality-frontend:${TAG} \
-f src/hospitality-web/Dockerfile \ -f src/hospitality-web/Dockerfile \
src/hospitality-web src/hospitality-web
@@ -60,9 +66,31 @@ jobs:
docker build \ docker build \
-t $REGISTRY/hospitality-api:${TAG} \ -t $REGISTRY/hospitality-api:${TAG} \
-f src/Hospitality.Backend/Dockerfile \ -f src/Hospitality.Backend/Dockerfile \
src/Hospitality.Backend .
# - name: Build API (${{ env.TAG }})
# run: |
# docker build \
# -t $REGISTRY/hospitality-api:${TAG} \
# -f src/Hospitality.Backend/Dockerfile \
# src/Hospitality.Backend
- name: Push API (${{ env.TAG }}) - name: Push API (${{ env.TAG }})
run: | run: |
docker push $REGISTRY/hospitality-api:${TAG} docker push $REGISTRY/hospitality-api:${TAG}
- name: Deploy containers
run: |
if [ "$TAG" = "dev" ]; then
echo "Deploying DEV til /srv/hospitality-dev"
cd /srv/hospitality-dev
docker compose -p hospitality-dev pull
docker compose -p hospitality-dev up -d
elif [ "$TAG" = "latest" ]; then
echo "Deploying PROD til /srv/hospitality-prod"
cd /srv/hospitality-prod
docker compose -p hospitality-prod pull
docker compose -p hospitality-prod up -d
else
echo "TAG=$TAG er ikke dev eller latest - skipper auto-deploy."
fi
+10 -11
View File
@@ -1,22 +1,21 @@
# --- Build stage ---
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src WORKDIR /src
# Kopier alt # Kopier bare csproj først for cache
COPY src/Hospitality.Backend/Hospitality.Backend.csproj src/Hospitality.Backend/
# Ev. også andre prosjekter hvis du vil optimalisere restore-steget:
# COPY src/Hospitality.Domain/Hospitality.Domain.csproj src/Hospitality.Domain/
# COPY src/Hospitality.Application/Hospitality.Application.csproj src/Hospitality.Application/
RUN dotnet restore "src/Hospitality.Backend/Hospitality.Backend.csproj"
# Nå resten av kildekoden
COPY . . COPY . .
# Publiser i Release WORKDIR /src/src/Hospitality.Backend
RUN dotnet publish "Hospitality.Backend.csproj" -c Release -o /app/publish RUN dotnet publish "Hospitality.Backend.csproj" -c Release -o /app/publish
# --- Runtime stage ---
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
WORKDIR /app WORKDIR /app
# Kopier publisert output
COPY --from=build /app/publish . COPY --from=build /app/publish .
# Appen lytter standard til ASPNETCORE_URLS
EXPOSE 8080
ENV ASPNETCORE_URLS=http://0.0.0.0:8080
ENTRYPOINT ["dotnet", "Hospitality.Backend.dll"] ENTRYPOINT ["dotnet", "Hospitality.Backend.dll"]
+6
View File
@@ -9,6 +9,9 @@ RUN npm ci
# Kopier resten av koden # Kopier resten av koden
COPY . . COPY . .
ARG VITE_API_URL
ENV VITE_API_URL=$VITE_API_URL
# Bygg for produksjon # Bygg for produksjon
RUN npm run build RUN npm run build
@@ -19,5 +22,8 @@ WORKDIR /usr/share/nginx/html
# Legg inn bygget frontend # Legg inn bygget frontend
COPY --from=build /app/dist . COPY --from=build /app/dist .
# Kopier custom nginx config for SPA routing
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Nginx server som statisk side # Nginx server som statisk side
EXPOSE 80 EXPOSE 80
@@ -0,0 +1,63 @@
version: "3.9"
networks:
hospitality-dev-net:
name: hospitality-dev-net
driver: bridge
edge:
external: true
services:
db:
image: postgres:16
container_name: hospitality-dev-db
restart: unless-stopped
environment:
POSTGRES_DB: hospitality_dev
POSTGRES_USER: hospitality_dev
POSTGRES_PASSWORD: devpassword
volumes:
- hospitality-dev-db-data:/var/lib/postgresql/data
networks:
- hospitality-dev-net
api:
image: gitea.theriise.net/steinhelge/hospitality-api:dev
container_name: hospitality-dev-api
restart: unless-stopped
environment:
ASPNETCORE_URLS: http://0.0.0.0:8080
ConnectionStrings__Default: "Host=db;Port=5432;Database=hospitality_dev;Username=hospitality_dev;Password=devpassword"
depends_on:
- db
networks:
- hospitality-dev-net
- edge
labels:
- "traefik.enable=true"
- "traefik.docker.network=edge"
- "traefik.http.routers.hospitality-dev-api.rule=Host(`hospitality-dev-api.theriise.net`)"
- "traefik.http.routers.hospitality-dev-api.entrypoints=websecure"
- "traefik.http.routers.hospitality-dev-api.tls=true"
web:
image: gitea.theriise.net/steinhelge/hospitality-frontend:dev
container_name: hospitality-dev-frontend
restart: unless-stopped
depends_on:
- api
networks:
- hospitality-dev-net
- edge
labels:
- "traefik.enable=true"
- "traefik.docker.network=edge"
- "traefik.http.routers.hospitality-dev.rule=Host(`hospitality-dev.theriise.net`)"
- "traefik.http.routers.hospitality-dev.entrypoints=websecure"
- "traefik.http.routers.hospitality-dev.tls=true"
volumes:
hospitality-dev-db-data:
#e7a87ddedabda8ee83bb3a246ce725dd9c030cb2
@@ -0,0 +1,61 @@
version: "3.9"
networks:
hospitality-net:
name: hospitality-net
driver: bridge
edge:
external: true
services:
db:
image: postgres:16
container_name: hospitality-db
restart: unless-stopped
environment:
POSTGRES_DB: hospitality
POSTGRES_USER: hospitality
POSTGRES_PASSWORD: supersecretpassword
volumes:
- hospitality-db-data:/var/lib/postgresql/data
networks:
- hospitality-net
api:
image: gitea.theriise.net/steinhelge/hospitality-api:latest
container_name: hospitality-api
restart: unless-stopped
environment:
ASPNETCORE_URLS: http://0.0.0.0:8080
# ASP.NET Core-style connection string via env:
ConnectionStrings__Default: "Host=db;Port=5432;Database=hospitality;Username=hospitality;Password=supersecretpassword"
depends_on:
- db
networks:
- hospitality-net
- edge
labels:
- "traefik.enable=true"
- "traefik.docker.network=edge"
- "traefik.http.routers.hospitality-api.rule=Host(`hospitality-api.theriise.net`)"
- "traefik.http.routers.hospitality-api.entrypoints=websecure"
- "traefik.http.routers.hospitality-api.tls=true"
web:
image: gitea.theriise.net/steinhelge/hospitality-frontend:latest
container_name: hospitality-frontend
restart: unless-stopped
depends_on:
- api
networks:
- hospitality-net
- edge
labels:
- "traefik.enable=true"
- "traefik.docker.network=edge"
- "traefik.http.routers.hospitality.rule=Host(`hospitality.theriise.net`)"
- "traefik.http.routers.hospitality.entrypoints=websecure"
- "traefik.http.routers.hospitality.tls=true"
volumes:
hospitality-db-data:
+17
View File
@@ -0,0 +1,17 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Support for SPA routing
location / {
try_files $uri $uri/ /index.html;
}
# Optional: Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires 1y;
add_header Cache-Control "public, no-transform";
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
import axios from 'axios'; import axios from 'axios';
import type { LoginRequest, LoginResponse, UserInfo } from '../types/auth'; import type { LoginRequest, LoginResponse, UserInfo } from '../types/auth';
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:5163/api'; const API_BASE_URL = import.meta.env.VITE_API_URL;
export const api = axios.create({ export const api = axios.create({
baseURL: API_BASE_URL, baseURL: API_BASE_URL,
@@ -1,5 +1,5 @@
import { useState } from 'react'; import { useState } from 'react';
import { Card, Form, Button, Badge, ListGroup, Alert } from 'react-bootstrap'; import { Card, Form, Button, ListGroup, Alert } from 'react-bootstrap';
import { usePersonByQrCode, useCreateTransaction } from '../../hooks/useQrCode'; import { usePersonByQrCode, useCreateTransaction } from '../../hooks/useQrCode';
export default function ScannerPage() { export default function ScannerPage() {
+12 -6
View File
@@ -3,11 +3,16 @@
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022", "target": "ES2022",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"], "lib": [
"ES2022",
"DOM",
"DOM.Iterable"
],
"module": "ESNext", "module": "ESNext",
"types": ["vite/client"], "types": [
"vite/client"
],
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
@@ -15,14 +20,15 @@
"moduleDetection": "force", "moduleDetection": "force",
"noEmit": true, "noEmit": true,
"jsx": "react-jsx", "jsx": "react-jsx",
/* Linting */ /* Linting */
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"erasableSyntaxOnly": true, "erasableSyntaxOnly": false,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true "noUncheckedSideEffectImports": true
}, },
"include": ["src"] "include": [
"src"
]
} }