Add Containerfile and nginx conf; update angular config; make CI pass
All checks were successful
/ build (push) Successful in 29s

This commit is contained in:
phil 2024-12-16 05:26:46 +01:00
parent 2663ad478b
commit 0acf593279
4 changed files with 225 additions and 27 deletions

View file

@ -69,6 +69,7 @@ jobs:
- name: Publish - name: Publish
if: fromJSON(steps.builder.outputs.run) if: fromJSON(steps.builder.outputs.run)
run: pnpm publish --no-git-checks run: pnpm publish --no-git-checks
continue-on-error: true
- name: Build container - name: Build container
if: fromJSON(steps.builder.outputs.run) if: fromJSON(steps.builder.outputs.run)

6
Containerfile Normal file
View file

@ -0,0 +1,6 @@
FROM docker.io/library/nginx:alpine
EXPOSE 80
COPY nginx.conf /etc/nginx/nginx.conf
COPY dist/gisaf/browser /usr/share/nginx/html

View file

@ -1,34 +1,49 @@
{ {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1, "version": 1,
"newProjectRoot": "projects", "newProjectRoot": "projects",
"projects": { "projects": {
"gisaf-app": { "gisaf": {
"root": "",
"projectType": "application", "projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:application",
"options": { "options": {
"outputPath": "dist", "outputPath": {
"base": "dist/gisaf"
},
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "polyfills": [
"tsConfig": "src/tsconfig.app.json", "src/polyfills.ts"
"polyfills": "src/polyfills.ts", ],
"tsConfig": "tsconfig.json",
"inlineStyleLanguage": "scss",
"assets": [ "assets": [
{ {
"glob": "**/*", "glob": "**/*",
"input": "src/assets", "input": "src/assets/",
"output": "/assets" "output": "/assets/"
}, },
{ {
"glob": "favicon.ico", "glob": "favicon.ico",
"input": "src", "input": "src/",
"output": "/" "output": "/"
}, },
{ {
"glob": "**/*", "glob": "**/*",
"input": "src/undefined", "input": "src/data/",
"output": "/" "output": "/data/"
} }
], ],
"styles": [ "styles": [
@ -62,9 +77,8 @@
"maplibre-gl", "maplibre-gl",
"@mapbox/point-geometry" "@mapbox/point-geometry"
], ],
"vendorChunk": true, "browser": "src/main.ts",
"extractLicenses": false, "extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true, "sourceMap": true,
"optimization": false, "optimization": false,
"namedChunks": true "namedChunks": true
@ -78,20 +92,25 @@
} }
], ],
"optimization": true, "optimization": true,
"outputHashing": "all",
"sourceMap": false, "sourceMap": false,
"namedChunks": false, "namedChunks": false,
"extractLicenses": true, "extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [ "fileReplacements": [
{ {
"src": "src/environments/environment.ts", "replace": "src/environments/environment.ts",
"replaceWith": "src/environments/environment.prod.ts" "with": "src/environments/environment.prod.ts"
} }
] ],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
} }
} },
"defaultConfiguration": "production"
}, },
"serve": { "serve": {
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
@ -101,23 +120,27 @@
}, },
"configurations": { "configurations": {
"production": { "production": {
"buildTarget": "gisaf-app:build:production" "buildTarget": "gisaf:build:production"
},
"development": {
"buildTarget": "gisaf:build:development"
} }
} },
"defaultConfiguration": "development"
}, },
"extract-i18n": { "extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n", "builder": "@angular-devkit/build-angular:extract-i18n",
"options": { "options": {
"buildTarget": "gisaf-app:build" "buildTarget": "gisaf:build"
} }
}, },
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular-devkit/build-angular:karma",
"options": { "options": {
"main": "src/test.ts", "main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json", "tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"scripts": [], "scripts": [],
"styles": [ "styles": [
{ {
@ -180,6 +203,7 @@
} }
}, },
"cli": { "cli": {
"analytics": false "analytics": false,
"packageManager": "pnpm"
} }
} }

167
nginx.conf Normal file
View file

@ -0,0 +1,167 @@
upstream aiohttp {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
# Unix domain servers
# server unix:/tmp/aiohttp-gisaf-1.sock fail_timeout=0;
server 127.0.0.1:5000 fail_timeout=0;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
#
#upstream websocket {
# server localhost:8080;
#}
server {
listen 8899;
gzip on;
gzip_types text/plain application/xml;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 1000;
server_name localhost;
charset utf-8;
client_max_body_size 4G;
root /usr/share/nginx/html;
location /tiles/ {
# proxy_pass http://localhost:8080/;
#proxy_pass http://127.0.0.1:3000/;
proxy_pass http://aiohttp;
}
location /api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass http://aiohttp;
}
location /graphql {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass http://aiohttp;
}
location /gj/live {
proxy_pass http://aiohttp;
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_buffering off;
}
location /_sched {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_buffering off;
}
location /graphql_sched/ {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass http://localhost:8080/graphql_sched;
}
location /gj/ {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass http://aiohttp;
}
location /auth {
## POST requests for JWT
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass http://aiohttp;
}
# location /admin {
# proxy_set_header Host $http_host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_http_version 1.1;
# proxy_buffering off;
# proxy_pass http://aiohttp;
# }
location /import/ {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass http://aiohttp;
}
location /download/ {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass http://aiohttp;
}
location /upload/ {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass http://aiohttp;
}
location /embed/ {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass http://aiohttp;
}
location = /index.html {
root /usr/share/nginx/html;
}
location / {
try_files $uri /index.html;
}
location /dashboard-attachment {
alias /home/phil/gisaf_misc/notebooks;
}
location = /favicon.ico {
root /usr/share/nginx/html;
}
# location /terrain {
# proxy_pass https://stamen-tiles-a.a.ssl.fastly.net/terrain;
# #proxy_set_header Host $host;
# proxy_buffering on;
# proxy_cache STAMEN;
# proxy_cache_valid 200 1d;
# proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
# }
# location "/download/attachment/formidable:trees/Picture/" {
# alias /home/phil/formidable_src/local_data/;
# }
}