Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
.angular
.git
.DS_Store
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:24.15-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist/admin-frontend/browser /usr/share/nginx/html
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 CMD wget -q -O /dev/null http://127.0.0.1/ || exit 1
9 changes: 5 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
"input": "public"
}
],
"styles": [
"src/styles.css"
]
"styles": ["src/styles.css"]
},
"configurations": {
"production": {
Expand Down Expand Up @@ -63,7 +61,10 @@
"buildTarget": "admin-frontend:build:development"
}
},
"defaultConfiguration": "development"
"defaultConfiguration": "development",
"options": {
"proxyConfig": "proxy.conf.json"
}
},
"test": {
"builder": "@angular/build:unit-test"
Expand Down
10 changes: 10 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
admin:
build:
context: .
dockerfile: Dockerfile
ports:
- "4200:80"
extra_hosts:
- "host.docker.internal:host-gateway"
restart: unless-stopped
16 changes: 16 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;

location /api/ {
proxy_pass http://host.docker.internal:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

location / {
try_files $uri $uri/ /index.html;
}
}
8 changes: 8 additions & 0 deletions proxy.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"/api": {
"target": "http://localhost:8000",
"secure": false,
"changeOrigin": true,
"pathRewrite": { "^/api": "" }
}
}
11 changes: 9 additions & 2 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
/**
* Runtime configuration for local development.
*
* `apiBaseUrl` points at the FastAPI service; `keycloak` matches the realm
* `apiBaseUrl` is a same-origin path, not a host. Both ways of running this app
* map `/api` onto the FastAPI service — nginx does it in the container,
* `proxy.conf.json` does it for `ng serve` — so the application never carries a
* hardcoded API host and the two behave identically.
*
* The Keycloak URL stays absolute because the browser is redirected to it, so a
* same-origin path would be meaningless there.
* `keycloak` matches the realm
* committed in the API repository (`keycloak/opentaberna-realm.json`).
*
* The client id matters: the API only accepts tokens on `/v1/admin/**` whose
Expand All @@ -10,7 +17,7 @@
*/
export const environment = {
production: false,
apiBaseUrl: 'http://localhost:8000',
apiBaseUrl: '/api',
/**
* Uncaught error reporting. Off by default; requires FRONTEND_ERRORS_ENABLED
* on the API, which otherwise answers the endpoint with a 404.
Expand Down
8 changes: 2 additions & 6 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"compilerOptions": {
"types": []
},
"include": [
"src/**/*.ts"
],
"exclude": [
"src/**/*.spec.ts"
]
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.spec.ts"]
}
9 changes: 2 additions & 7 deletions tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"types": [
"vitest/globals"
]
"types": ["vitest/globals"]
},
"include": [
"src/**/*.d.ts",
"src/**/*.spec.ts"
]
"include": ["src/**/*.d.ts", "src/**/*.spec.ts"]
}
Loading