2025-03-25 13:35:24 +00:00
|
|
|
# 1. Node.js Build-Stage
|
2025-04-02 12:24:32 +00:00
|
|
|
FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1 AS build
|
2025-03-25 08:54:22 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY package*.json ./
|
2025-04-10 12:36:39 +00:00
|
|
|
COPY tsconfig.json ./
|
|
|
|
COPY tsconfig.backend.json ./
|
2025-04-11 07:44:00 +00:00
|
|
|
COPY . .
|
2025-03-25 08:54:22 +00:00
|
|
|
|
2025-04-11 09:21:06 +00:00
|
|
|
### NEW ###
|
|
|
|
RUN npm install cors
|
|
|
|
|
2025-03-26 09:31:06 +00:00
|
|
|
RUN npm install -g npm@11.2.0
|
2025-04-09 14:12:34 +00:00
|
|
|
RUN npm install
|
2025-03-25 11:39:58 +00:00
|
|
|
|
2025-04-11 07:44:00 +00:00
|
|
|
# Danach server.ts kompilieren, nachdem broker.mjs existiert
|
|
|
|
RUN npx tsc -p tsconfig.backend.json
|
2025-04-09 13:47:06 +00:00
|
|
|
|
2025-04-11 08:25:14 +00:00
|
|
|
# Danach können wir die Frontend-Dateien auch kompilieren
|
|
|
|
RUN npx tsc -p tsconfig.frontend.json
|
|
|
|
|
2025-03-26 10:39:02 +00:00
|
|
|
# 2. Rust build-Stage
|
2025-04-02 12:24:32 +00:00
|
|
|
FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/rust:1.74.0 AS rust-build
|
2025-03-25 11:39:58 +00:00
|
|
|
RUN cargo install iching
|
2025-03-25 08:54:22 +00:00
|
|
|
|
2025-04-09 14:12:34 +00:00
|
|
|
# 3. Final runtime
|
2025-04-02 12:24:32 +00:00
|
|
|
FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1
|
2025-03-25 13:35:24 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
2025-03-25 08:54:22 +00:00
|
|
|
|
2025-04-10 12:36:39 +00:00
|
|
|
# Kopiere Node-Modules und alle generierten Dateien
|
2025-04-10 09:16:11 +00:00
|
|
|
COPY --from=build /app/node_modules ./node_modules
|
2025-04-09 14:12:34 +00:00
|
|
|
COPY --from=build /app/dist ./dist
|
2025-04-10 08:21:29 +00:00
|
|
|
COPY --from=build /app/frontend/index.html ./dist/frontend/
|
2025-04-11 08:15:59 +00:00
|
|
|
COPY --from=build /app/package.json ./dist/backend/
|
|
|
|
|
2025-04-11 08:37:01 +00:00
|
|
|
# Neu: Konfigurationsdatei ins Backend-Verzeichnis
|
2025-04-11 08:58:39 +00:00
|
|
|
#COPY --from=build /app/backend/config.json ./dist/backend/
|
2025-04-11 08:37:01 +00:00
|
|
|
|
2025-04-07 14:31:26 +00:00
|
|
|
COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching
|
2025-04-08 08:48:46 +00:00
|
|
|
|
2025-04-10 12:36:39 +00:00
|
|
|
# Falls notwendig: Umbenennen von .js zu .mjs
|
2025-04-10 08:51:23 +00:00
|
|
|
RUN find dist/frontend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \;
|
2025-04-10 08:21:29 +00:00
|
|
|
|
2025-04-10 12:36:39 +00:00
|
|
|
# Starte den Backend-Server
|
2025-04-11 08:15:59 +00:00
|
|
|
#CMD ["node", "--loader", "ts-node/esm", "/app/dist/backend/server.js"]
|
2025-04-10 12:36:39 +00:00
|
|
|
# Starte den Frontend-Server
|
2025-04-11 08:15:59 +00:00
|
|
|
#CMD ["npx", "http-server", "dist/frontend", "-p", "8080", "--mime", "application/javascript=js"]
|
|
|
|
|
|
|
|
COPY start.sh ./start.sh
|
|
|
|
RUN chmod +x ./start.sh
|
|
|
|
|
|
|
|
CMD ["./start.sh"]
|