Compare commits
23 Commits
43e4446971
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ff03552ea | |||
| 63eb33a8c9 | |||
| f5f56b0407 | |||
| 0dba448f15 | |||
| 072935e133 | |||
| c3750239c7 | |||
| d1568c788a | |||
| dcc8e10bd2 | |||
| 68ecdb0056 | |||
| bde8e8bedc | |||
| 07af11b541 | |||
| bdfdcbe0f7 | |||
| 16864584e4 | |||
| a5ec63b064 | |||
| bd64eea849 | |||
| a298159ce2 | |||
| 7ae6871f1c | |||
| 030f1d8b49 | |||
| 4a055b5cde | |||
| 77a795ddcc | |||
| f6243ba5ba | |||
| 8a464aebf4 | |||
| 011434ba56 |
@@ -7,12 +7,11 @@ on:
|
||||
- dev
|
||||
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.theriise.net/steinhelge
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: self-hosted
|
||||
env:
|
||||
REGISTRY: gitea.theriise.net/steinhelge
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -45,7 +44,14 @@ jobs:
|
||||
# ---------- Frontend ----------
|
||||
- name: Build Frontend (${{ env.TAG }})
|
||||
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 \
|
||||
--build-arg VITE_API_URL=$API_URL \
|
||||
-t $REGISTRY/hospitality-frontend:${TAG} \
|
||||
-f src/hospitality-web/Dockerfile \
|
||||
src/hospitality-web
|
||||
@@ -60,9 +66,31 @@ jobs:
|
||||
docker build \
|
||||
-t $REGISTRY/hospitality-api:${TAG} \
|
||||
-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 }})
|
||||
run: |
|
||||
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
|
||||
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
# --- Build stage ---
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
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 . .
|
||||
|
||||
# Publiser i Release
|
||||
WORKDIR /src/src/Hospitality.Backend
|
||||
RUN dotnet publish "Hospitality.Backend.csproj" -c Release -o /app/publish
|
||||
|
||||
# --- Runtime stage ---
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
|
||||
WORKDIR /app
|
||||
|
||||
# Kopier publisert output
|
||||
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"]
|
||||
|
||||
@@ -67,7 +67,7 @@ builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowFrontend", policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:5173")
|
||||
policy.SetIsOriginAllowed(origin => true) // Allow any origin
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
@@ -97,7 +97,7 @@ if (app.Environment.IsDevelopment())
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
// app.UseHttpsRedirection(); // Disabled because Traefik handles SSL
|
||||
|
||||
app.UseCors("AllowFrontend");
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ RUN npm ci
|
||||
# Kopier resten av koden
|
||||
COPY . .
|
||||
|
||||
ARG VITE_API_URL
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
|
||||
# Bygg for produksjon
|
||||
RUN npm run build
|
||||
|
||||
@@ -19,5 +22,8 @@ WORKDIR /usr/share/nginx/html
|
||||
# Legg inn bygget frontend
|
||||
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
|
||||
EXPOSE 80
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
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__DefaultConnection: "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"
|
||||
- "traefik.http.services.hospitality-dev-api.loadbalancer.server.port=8080"
|
||||
|
||||
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"
|
||||
- "traefik.http.services.hospitality-dev.loadbalancer.server.port=80"
|
||||
|
||||
volumes:
|
||||
hospitality-dev-db-data:
|
||||
|
||||
|
||||
#e7a87ddedabda8ee83bb3a246ce725dd9c030cb2
|
||||
@@ -0,0 +1,62 @@
|
||||
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
|
||||
ConnectionStrings__DefaultConnection: "Host=db;Port=5432;Database=hospitality;Username=hospitality;Password=superhemmelig"
|
||||
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"
|
||||
- "traefik.http.services.hospitality-api.loadbalancer.server.port=8080"
|
||||
|
||||
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"
|
||||
- "traefik.http.services.hospitality.loadbalancer.server.port=80"
|
||||
|
||||
volumes:
|
||||
hospitality-db-data:
|
||||
@@ -0,0 +1,17 @@
|
||||
server {
|
||||
listen 0.0.0.0:80;
|
||||
server_name _;
|
||||
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,7 +1,7 @@
|
||||
import axios from 'axios';
|
||||
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({
|
||||
baseURL: API_BASE_URL,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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';
|
||||
|
||||
export default function ScannerPage() {
|
||||
|
||||
@@ -3,11 +3,16 @@
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"lib": [
|
||||
"ES2022",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"module": "ESNext",
|
||||
"types": ["vite/client"],
|
||||
"types": [
|
||||
"vite/client"
|
||||
],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
@@ -15,14 +20,15 @@
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"erasableSyntaxOnly": false,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user