Compare commits

...

3 Commits

Author SHA1 Message Date
76a8774695 generate own UUID if crypto is not available
All checks were successful
Deploy Frontend / deploy (push) Successful in 1m58s
2026-04-26 22:02:15 +02:00
b185b8c1ad Add docker-compose and fix CI network creation
All checks were successful
Deploy Frontend / deploy (push) Successful in 4m22s
2026-04-26 18:03:10 +02:00
c5770b4d63 update CI/CD with compose 2026-04-26 17:55:59 +02:00
3 changed files with 38 additions and 14 deletions

View File

@@ -16,19 +16,14 @@ jobs:
- name: Extract version tag
run: echo "VERSION_TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV
- name: Create shared network if missing
run: docker network create poster-picker || true
- name: Build Docker image
run: |
docker build \
--build-arg REACT_APP_API_URL="" \
-t poster-picker-frontend:latest \
-t poster-picker-frontend:${{ env.VERSION_TAG }} .
run: docker compose build
- name: Stop old container
run: |
cd ~/dev-server/poster-picker
docker compose stop frontend || true
- name: Stop old container (if exists)
run: docker compose down --remove-orphans || true
- name: Start new container
run: |
cd ~/dev-server/poster-picker
docker compose up -d --no-build frontend
- name: Run compose
run: docker compose up -d

19
docker-compose.yml Normal file
View File

@@ -0,0 +1,19 @@
services:
frontend:
build:
context: .
args:
REACT_APP_API_URL: ""
image: poster-picker-frontend:latest
ports:
- "8081:80"
restart: unless-stopped
networks:
- poster-picker
- caddy-external
networks:
poster-picker:
external: true
caddy-external:
external: true

View File

@@ -1,9 +1,19 @@
import axios from "axios";
const generateUUID = () => {
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
return crypto.randomUUID();
}
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0;
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
});
};
export const getUserId = () => {
let id = localStorage.getItem("poster_picker_uid");
if (!id) {
id = crypto.randomUUID();
id = generateUUID();
localStorage.setItem("poster_picker_uid", id);
}
return id;