iching-broker-level2/Dockerfile

44 lines
1.2 KiB
Docker
Raw 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-09 14:12:34 +00:00
COPY . .
2025-03-25 08:54:22 +00:00
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-10 08:21:29 +00:00
#RUN npx tsc -p tsconfig.json
RUN npx tsc -p tsconfig.backend.json
RUN npx tsc -p tsconfig.frontend.json
2025-04-09 13:47:06 +00:00
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-09 14:12:34 +00:00
COPY --from=build /app/dist ./dist
2025-04-10 08:21:29 +00:00
#COPY --from=build /app/index.html ./dist/
COPY --from=build /app/frontend/index.html ./dist/frontend/
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 08:21:29 +00:00
### NEW ###
RUN find dist/backend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.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 08:32:14 +00:00
#RUN mkdir -p dist/iching
2025-04-10 08:21:29 +00:00
#RUN cp dist/*.js dist/iching/
2025-04-08 08:48:46 +00:00
2025-04-10 08:21:29 +00:00
#RUN node dist/iching/server.js
RUN node dist/backend/server.mjs &
2025-04-10 06:57:08 +00:00
2025-04-10 08:21:29 +00:00
#CMD ["npx", "http-server", "dist", "-p", "8080", "--mime", "application/javascript=js"]
CMD ["npx", "http-server", "dist/frontend", "-p", "8080", "--mime", "application/javascript=js"]