Compare commits

..

9 Commits

Author SHA1 Message Date
000946c52d 📄 Add license for new script
All checks were successful
continuous-integration/drone/pr Build is passing
2024-01-12 19:16:23 +01:00
7bba73ceae 🔧 Configure KI API URL from environment
Some checks failed
continuous-integration/drone/pr Build is failing
With an entrypoint script, fill the configuration template from an
environment variable containing the KI API URL.
2024-01-12 19:12:18 +01:00
c2552f3c3a Merge pull request 'Push image to Gitea registry' (!84) from gitea-registry into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #84
2023-12-10 18:47:54 +01:00
687454afdb Push image to Gitea registry
All checks were successful
continuous-integration/drone/pr Build is passing
2023-12-04 20:09:52 +01:00
a7c8774cc4 Merge pull request 'Add labels to Docker images' (!83) from docker-labels into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #83
2023-11-16 11:18:44 +01:00
b63e5a6c2d Merge pull request 'Rewrite Drone config' (!82) from drone-config into main
Some checks are pending
continuous-integration/drone/push Build is pending
Reviewed-on: #82
2023-11-16 11:18:35 +01:00
1b221ab180 Merge pull request 'Improve SPA cacheing' (!81) from nginx-cacheing into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #81
2023-11-13 16:51:10 +01:00
e2b101eb89 Add labels to Docker images
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-11-07 14:54:40 +01:00
26edf1d4b2 Improve SPA cacheing
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-11-06 18:35:05 +01:00
5 changed files with 54 additions and 7 deletions

View File

@ -40,8 +40,8 @@ steps:
- name: docker-publish
image: plugins/docker
settings:
registry: registry.wtf-eg.net
repo: registry.wtf-eg.net/ki-frontend
registry: git.wtf-eg.de
repo: git.wtf-eg.de/kompetenzinventar/frontend
target: ki-frontend
auto_tag: true
username:
@ -96,8 +96,8 @@ steps:
- name: docker-publish
image: plugins/docker
settings:
registry: registry.wtf-eg.net
repo: registry.wtf-eg.net/ki-frontend
registry: git.wtf-eg.de
repo: git.wtf-eg.de/kompetenzinventar/frontend
target: ki-frontend
auto_tag: true
username:

View File

@ -13,3 +13,16 @@ FROM nginx as ki-frontend
COPY --from=builder /dist/ /usr/share/nginx/html/
COPY etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
LABEL org.opencontainers.image.source=https://git.wtf-eg.de/kompetenzinventar/ki-frontend.git
LABEL org.opencontainers.image.url=https://git.wtf-eg.de/kompetenzinventar/ki-frontend
LABEL org.opencontainers.image.documentation=https://git.wtf-eg.de/kompetenzinventar/ki-frontend#docker
LABEL org.opencontainers.image.vendor="WTF Kooperative eG"
ENV KI_API_URL http://ki-backend:5000
WORKDIR /usr/share/nginx/html
COPY etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
COPY configure.sh /docker-entrypoint.d/
COPY --from=builder /dist .

13
configure.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
set -o errexit
set +x
: ${KI_API_URL:=http://ki-backend:5000}
sed -e "s%\$KI_API_URL%$KI_API_URL%g" /usr/share/nginx/html/config.js.in > /usr/share/nginx/html/config.js
exec "$@"

View File

@ -9,10 +9,24 @@ server {
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
# routes without dots serve the index.html without caching
location / {
add_header Cache-Control "no-cache";
try_files $uri $uri/index.html /index.html;
}
# static js and css files that get replaced instead of updated
location ~ \.(js|css) {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# cache other static files for 30 days
location ~ \.(?!html) {
add_header Cache-Control "public, max-age=2592000";
try_files $uri =404;
}
#error_page 404 /404.html;

7
public/config.js.in Normal file
View File

@ -0,0 +1,7 @@
// SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
window.ki = {
apiUrl: "$KI_API_URL"
}