add http-server part 8.5.1
This commit is contained in:
parent
43d4514bc6
commit
0189cc2157
5 changed files with 6 additions and 26 deletions
18
Dockerfile
18
Dockerfile
|
@ -8,16 +8,11 @@ COPY tsconfig.json ./
|
||||||
COPY tsconfig.backend.json ./
|
COPY tsconfig.backend.json ./
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
### NEW ###
|
|
||||||
RUN npm install cors
|
RUN npm install cors
|
||||||
|
|
||||||
RUN npm install -g npm@11.2.0
|
RUN npm install -g npm@11.2.0
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
# Danach server.ts kompilieren, nachdem broker.mjs existiert
|
|
||||||
RUN npx tsc -p tsconfig.backend.json
|
RUN npx tsc -p tsconfig.backend.json
|
||||||
|
|
||||||
# Danach können wir die Frontend-Dateien auch kompilieren
|
|
||||||
RUN npx tsc -p tsconfig.frontend.json
|
RUN npx tsc -p tsconfig.frontend.json
|
||||||
|
|
||||||
# 2. Rust build-Stage
|
# 2. Rust build-Stage
|
||||||
|
@ -29,25 +24,18 @@ FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Kopiere Node-Modules und alle generierten Dateien
|
# Copy node_modules and all generated data
|
||||||
COPY --from=build /app/node_modules ./node_modules
|
COPY --from=build /app/node_modules ./node_modules
|
||||||
COPY --from=build /app/dist ./dist
|
COPY --from=build /app/dist ./dist
|
||||||
COPY --from=build /app/frontend/index.html ./dist/frontend/
|
COPY --from=build /app/frontend/index.html ./dist/frontend/
|
||||||
COPY --from=build /app/package.json ./dist/backend/
|
COPY --from=build /app/package.json ./dist/backend/
|
||||||
|
|
||||||
# Neu: Konfigurationsdatei ins Backend-Verzeichnis
|
# Copy iching library
|
||||||
#COPY --from=build /app/backend/config.json ./dist/backend/
|
|
||||||
|
|
||||||
COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching
|
COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching
|
||||||
|
|
||||||
# Falls notwendig: Umbenennen von .js zu .mjs
|
# Frontend: rename from .js to .mjs
|
||||||
RUN find dist/frontend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \;
|
RUN find dist/frontend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \;
|
||||||
|
|
||||||
# Starte den Backend-Server
|
|
||||||
#CMD ["node", "--loader", "ts-node/esm", "/app/dist/backend/server.js"]
|
|
||||||
# Starte den Frontend-Server
|
|
||||||
#CMD ["npx", "http-server", "dist/frontend", "-p", "8080", "--mime", "application/javascript=js"]
|
|
||||||
|
|
||||||
COPY start.sh ./start.sh
|
COPY start.sh ./start.sh
|
||||||
RUN chmod +x ./start.sh
|
RUN chmod +x ./start.sh
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*import { html } from "./broker";
|
/*import { html } from "./broker";
|
||||||
import { test, beforeAll, afterAll } from "@jest/globals";
|
import { test } from "@jest/globals";
|
||||||
|
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
function handleClick(): void {
|
function handleClick(): void {
|
||||||
console.log("Der Button wurde geklickt!");
|
console.log("Der Button wurde geklickt!");
|
||||||
//alert("Hallo von TypeScript!");
|
|
||||||
|
|
||||||
fetch("/iching/api/command", { method: "POST" })
|
fetch("/iching/api/command", { method: "POST" })
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
"use strict";
|
|
||||||
module.exports = {
|
|
||||||
transform: {
|
|
||||||
"^.+\\.tsx?$": "ts-jest"
|
|
||||||
}
|
|
||||||
};
|
|
5
start.sh
5
start.sh
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/bash
|
# start backend in the background
|
||||||
# Starte Backend im Hintergrund
|
|
||||||
node dist/backend/server.js &
|
node dist/backend/server.js &
|
||||||
|
|
||||||
# Starte Frontend
|
# start frontend
|
||||||
npx http-server dist/frontend -p 8080 --cors --mime application/javascript=js
|
npx http-server dist/frontend -p 8080 --cors --mime application/javascript=js
|
Loading…
Reference in a new issue