iching-broker-level2/Dockerfile

42 lines
1.1 KiB
Text
Raw Permalink Normal View History

2025-03-25 14:35:24 +01: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 09:54:22 +01:00
WORKDIR /app
COPY package*.json ./
2025-04-10 14:36:39 +02:00
COPY tsconfig.json ./
COPY tsconfig.backend.json ./
2025-04-11 09:44:00 +02:00
COPY . .
2025-03-25 09:54:22 +01:00
2025-04-11 11:21:06 +02:00
RUN npm install cors
2025-03-26 10:31:06 +01:00
RUN npm install -g npm@11.2.0
2025-04-09 16:12:34 +02:00
RUN npm install
2025-03-25 12:39:58 +01:00
2025-04-11 09:44:00 +02:00
RUN npx tsc -p tsconfig.backend.json
2025-04-11 10:25:14 +02:00
RUN npx tsc -p tsconfig.frontend.json
2025-03-26 11:39:02 +01: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 12:39:58 +01:00
RUN cargo install iching
2025-03-25 09:54:22 +01:00
2025-04-09 16:12:34 +02: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 14:35:24 +01:00
WORKDIR /app
2025-03-25 09:54:22 +01:00
2025-04-14 15:02:31 +02:00
# Copy node_modules and all generated data
2025-04-10 11:16:11 +02:00
COPY --from=build /app/node_modules ./node_modules
2025-04-09 16:12:34 +02:00
COPY --from=build /app/dist ./dist
2025-04-10 10:21:29 +02:00
COPY --from=build /app/frontend/index.html ./dist/frontend/
2025-04-11 10:15:59 +02:00
COPY --from=build /app/package.json ./dist/backend/
2025-04-14 15:02:31 +02:00
# Copy iching library
2025-04-07 16:31:26 +02:00
COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching
2025-04-08 10:48:46 +02:00
2025-04-14 15:02:31 +02:00
# Frontend: rename from .js to .mjs
2025-04-10 10:51:23 +02:00
RUN find dist/frontend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \;
2025-04-10 10:21:29 +02:00
2025-04-11 10:15:59 +02:00
COPY start.sh ./start.sh
RUN chmod +x ./start.sh
CMD ["./start.sh"]