iching-broker-level2/Dockerfile

42 lines
1.1 KiB
Docker
Raw Permalink Normal View History

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
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
RUN npx tsc -p tsconfig.backend.json
2025-04-11 08:25:14 +00:00
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-14 13:02:31 +00:00
# Copy node_modules and all generated data
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-14 13:02:31 +00:00
# Copy iching library
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-14 13:02:31 +00:00
# Frontend: rename from .js to .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-11 08:15:59 +00:00
COPY start.sh ./start.sh
RUN chmod +x ./start.sh
CMD ["./start.sh"]