feat: containerize

This commit is contained in:
js0ny 2025-12-06 09:48:30 +00:00
parent 83bb72faac
commit 82a78da81b
10 changed files with 319 additions and 55 deletions

11
drone-frontend/Dockerfile Normal file
View file

@ -0,0 +1,11 @@
# Build stage
FROM oven/bun:1.3-debian as builder
WORKDIR /app
COPY bun.lock package.json .
RUN bun install --frozen-lockfile
COPY . .
RUN bun run build
# Serve built assets via Vite preview
EXPOSE 4173
CMD ["bun", "run", "preview", "--", "--host", "0.0.0.0", "--port", "4173"]

View file

@ -3,7 +3,6 @@
import L from "leaflet";
import { theme } from "./stores.js";
import {
STEP_SECONDS,
defaultDispatch,
samplePathResponse,
fallbackBounds,
@ -20,6 +19,8 @@
let palette = [];
let lightTiles, darkTiles;
let STEP_SECONDS = 1;
function updatePalette() {
if (typeof document === "undefined") return;
const style = getComputedStyle(document.documentElement);
@ -197,7 +198,7 @@
fitMapToBounds();
refreshMap();
loadRestrictedAreas();
loadServicePoints();
// loadServicePoints();
return () => map?.remove();
});
@ -346,31 +347,31 @@
currentPositions.forEach((drone, idx) => {
const color = colorFor(idx, palette);
// Draw Full Trajectory (Dimmed)
if (drone.path.length > 1) {
L.polyline(
drone.path.map((p) => [p.lat, p.lng]),
{
color: color,
weight: 2,
opacity: 0.2,
dashArray: "4, 8", // Dashed line for future path
},
).addTo(pathLayer);
}
// Draw Visited Trajectory (Bright)
if (drone.visited.length > 1) {
L.polyline(
drone.visited.map((p) => [p.lat, p.lng]),
{
color: color,
weight: 3,
opacity: 0.9,
className: "neon-path", // Can add glow via CSS if desired
},
).addTo(pathLayer);
}
// // Draw Full Trajectory (Dimmed)
// if (drone.path.length > 1) {
// L.polyline(
// drone.path.map((p) => [p.lat, p.lng]),
// {
// color: color,
// weight: 2,
// opacity: 0.2,
// dashArray: "4, 8", // Dashed line for future path
// },
// ).addTo(pathLayer);
// }
//
// // Draw Visited Trajectory (Bright)
// if (drone.visited.length > 1) {
// L.polyline(
// drone.visited.map((p) => [p.lat, p.lng]),
// {
// color: color,
// weight: 3,
// opacity: 0.9,
// className: "neon-path", // Can add glow via CSS if desired
// },
// ).addTo(pathLayer);
// }
// Draw Drone Marker
if (drone.current) {