update dockerfiles and github workflows

This commit is contained in:
2026-04-27 12:08:03 +02:00
parent 10deecfb35
commit 13954c0fd6
5 changed files with 23 additions and 43 deletions
+6 -2
View File
@@ -25,7 +25,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
lfs: true # WICHTIG: Lädt die echten LFS-Dateien (MaxMind DBs) herunter lfs: true
- name: Get short SHA - name: Get short SHA
id: vars id: vars
@@ -58,6 +58,8 @@ jobs:
build-args: | build-args: |
GIT_COMMIT_SHA=${{ steps.vars.outputs.sha }} GIT_COMMIT_SHA=${{ steps.vars.outputs.sha }}
SENTRY_DSN=${{ secrets.SENTRY_DSN }} SENTRY_DSN=${{ secrets.SENTRY_DSN }}
cache-from: type=gha,scope=backend
cache-to: type=gha,mode=max,scope=backend
- name: Tag backend with extra_tag (manifest retag) - name: Tag backend with extra_tag (manifest retag)
if: ${{ github.event.inputs.extra_tag && github.event.inputs.extra_tag != '' }} if: ${{ github.event.inputs.extra_tag && github.event.inputs.extra_tag != '' }}
@@ -80,10 +82,12 @@ jobs:
build-args: | build-args: |
GIT_COMMIT_SHA=${{ steps.vars.outputs.sha }} GIT_COMMIT_SHA=${{ steps.vars.outputs.sha }}
SENTRY_DSN=${{ secrets.SENTRY_DSN }} SENTRY_DSN=${{ secrets.SENTRY_DSN }}
cache-from: type=gha,scope=frontend
cache-to: type=gha,mode=max,scope=frontend
- name: Tag frontend with extra_tag (manifest retag) - name: Tag frontend with extra_tag (manifest retag)
if: ${{ github.event.inputs.extra_tag && github.event.inputs.extra_tag != '' }} if: ${{ github.event.inputs.extra_tag && github.event.inputs.extra_tag != '' }}
run: | run: |
docker buildx imagetools create \ docker buildx imagetools create \
-t ${{ env.REGISTRY }}/${{ env.DOCKERHUB_USER_LC }}/utools-frontend:${{ github.event.inputs.extra_tag }} \ -t ${{ env.REGISTRY }}/${{ env.DOCKERHUB_USER_LC }}/utools-frontend:${{ github.event.inputs.extra_tag }} \
${{ env.REGISTRY }}/${{ env.DOCKERHUB_USER_LC }}/utools-frontend:${{ steps.vars.outputs.sha }} ${{ env.REGISTRY }}/${{ env.DOCKERHUB_USER_LC }}/utools-frontend:${{ steps.vars.outputs.sha }}
+12 -38
View File
@@ -1,14 +1,13 @@
name: Update MaxMind GeoLite2 DBs name: Update MaxMind GeoLite2 DBs
on: on:
workflow_dispatch: # Ermöglicht manuelles Starten workflow_dispatch:
schedule: schedule:
- cron: '0 0 1 * *' - cron: '0 0 1 * *'
jobs: jobs:
update-db: update-db:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Berechtigung, um Änderungen zurück ins Repo zu pushen
permissions: permissions:
contents: write contents: write
@@ -16,71 +15,46 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
lfs: true # Wichtig: LFS-Dateien beim Checkout herunterladen lfs: true
- name: Download geoipupdate tool - name: Download latest geoipupdate
run: | run: |
# Lade eine spezifische Version oder die neueste herunter GEOIPUPDATE_VERSION=$(curl -fsSL https://api.github.com/repos/maxmind/geoipupdate/releases/latest | jq -r '.tag_name | ltrimstr("v")')
GEOIPUPDATE_VERSION="4.11.1" echo "Installing geoipupdate v${GEOIPUPDATE_VERSION}"
wget "https://github.com/maxmind/geoipupdate/releases/download/v${GEOIPUPDATE_VERSION}/geoipupdate_${GEOIPUPDATE_VERSION}_linux_amd64.tar.gz" wget -q "https://github.com/maxmind/geoipupdate/releases/download/v${GEOIPUPDATE_VERSION}/geoipupdate_${GEOIPUPDATE_VERSION}_linux_amd64.tar.gz"
tar -zxvf "geoipupdate_${GEOIPUPDATE_VERSION}_linux_amd64.tar.gz" tar -xzf "geoipupdate_${GEOIPUPDATE_VERSION}_linux_amd64.tar.gz"
# Verschiebe das Binary in einen bekannten Pfad und mache es ausführbar
sudo mv "geoipupdate_${GEOIPUPDATE_VERSION}_linux_amd64/geoipupdate" /usr/local/bin/ sudo mv "geoipupdate_${GEOIPUPDATE_VERSION}_linux_amd64/geoipupdate" /usr/local/bin/
sudo chmod +x /usr/local/bin/geoipupdate
# Überprüfe die Version
geoipupdate -V geoipupdate -V
- name: Create GeoIP.conf - name: Create GeoIP.conf
# Erstellt die Konfigurationsdatei für geoipupdate mit den Secrets
run: | run: |
echo "Creating GeoIP.conf..."
cat << EOF > GeoIP.conf cat << EOF > GeoIP.conf
# GeoIP.conf file for geoipupdate
AccountID ${{ secrets.MAXMIND_ACCOUNT_ID }} AccountID ${{ secrets.MAXMIND_ACCOUNT_ID }}
LicenseKey ${{ secrets.MAXMIND_LICENSE_KEY }} LicenseKey ${{ secrets.MAXMIND_LICENSE_KEY }}
# Specify the editions to download
EditionIDs GeoLite2-ASN GeoLite2-City EditionIDs GeoLite2-ASN GeoLite2-City
EOF EOF
echo "GeoIP.conf created."
env: env:
MAXMIND_ACCOUNT_ID: ${{ secrets.MAXMIND_ACCOUNT_ID }} MAXMIND_ACCOUNT_ID: ${{ secrets.MAXMIND_ACCOUNT_ID }}
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }} MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
- name: Run geoipupdate - name: Run geoipupdate
run: | run: geoipupdate -f GeoIP.conf -d ./backend/data -v
echo "Running geoipupdate..."
# Lädt die Datenbanken nach ./backend/data herunter
geoipupdate -f GeoIP.conf -d ./backend/data -v
echo "geoipupdate finished."
- name: Configure Git and LFS - name: Configure Git and LFS
run: | run: |
git config --global user.name 'github-actions[bot]' git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com' git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Installiere Git LFS Hooks für diesen Run
git lfs install git lfs install
- name: Track and Commit changes (LFS) - name: Commit and push updated databases
run: | run: |
# Sage Git, dass .mmdb Dateien mit LFS verwaltet werden sollen
git lfs track "backend/data/*.mmdb" git lfs track "backend/data/*.mmdb"
git add .gitattributes ./backend/data/*.mmdb
# Füge .gitattributes (hier steht die LFS-Konfiguration drin) hinzu
git add .gitattributes
# Füge die eigentlichen Datenbank-Dateien hinzu
git add ./backend/data/*.mmdb
# Prüfe, ob Änderungen zum Committen vorliegen (staged changes)
if git diff --staged --quiet; then if git diff --staged --quiet; then
echo "No changes detected in MaxMind databases." echo "No changes detected in MaxMind databases."
else else
echo "Changes detected. Committing..." git commit -m "Update MaxMind GeoLite2 databases (LFS) ($(date -u +%Y-%m-%d))"
COMMIT_DATE=$(date -u +"%Y-%m-%d")
git commit -m "Update MaxMind GeoLite2 databases (LFS) (${COMMIT_DATE})"
git push git push
echo "Changes pushed via LFS."
fi fi
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1 -2
View File
@@ -14,8 +14,7 @@ COPY package*.json ./
# Install app dependencies using npm ci for faster, reliable builds # Install app dependencies using npm ci for faster, reliable builds
# --only=production installs only production dependencies (including 'oui') # --only=production installs only production dependencies (including 'oui')
RUN npm ci --only=production RUN npm ci --omit=dev
# REMOVED: RUN npm i oui (should be installed by npm ci now)
# Stage 2: Production Image # Stage 2: Production Image
FROM node:24-alpine FROM node:24-alpine
+3
View File
@@ -9,6 +9,9 @@
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"engines": {
"node": ">=24"
},
"dependencies": { "dependencies": {
"@maxmind/geoip2-node": "^6.0.0", "@maxmind/geoip2-node": "^6.0.0",
"@sentry/node": "^10.42.0", "@sentry/node": "^10.42.0",
+1 -1
View File
@@ -2,7 +2,7 @@
# Aktuell nicht nötig, da wir CDN/statische Dateien haben. # Aktuell nicht nötig, da wir CDN/statische Dateien haben.
# Stage 2: Production Environment using Nginx # Stage 2: Production Environment using Nginx
FROM nginx:1.25-alpine FROM nginx:1.27-alpine
# Arbeitsverzeichnis im Container (optional, aber gute Praxis) # Arbeitsverzeichnis im Container (optional, aber gute Praxis)
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html