| |
| FROM rust:1.75-bookworm as rust-builder |
| WORKDIR /app |
| RUN apt-get update && apt-get install -y pkg-config libssl-dev |
| COPY rust-engine /app/rust-engine |
| WORKDIR /app/rust-engine |
| |
| RUN cargo build --release |
|
|
| |
| FROM node:20-bookworm as node-builder |
| WORKDIR /app |
| COPY package*.json ./ |
| RUN npm install |
| COPY . . |
| RUN npm run build |
|
|
| |
| FROM node:20-bookworm |
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| ca-certificates \ |
| curl \ |
| build-essential \ |
| pkg-config \ |
| libssl-dev \ |
| git \ |
| && update-ca-certificates \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| ENV PATH="/root/.cargo/bin:${PATH}" |
|
|
| WORKDIR /app |
|
|
| |
| COPY --from=node-builder /app/dist /app/dist |
| COPY --from=node-builder /app/package*.json /app/ |
| COPY --from=node-builder /app/server.ts /app/ |
| COPY --from=node-builder /app/node_modules /app/node_modules |
| COPY --from=node-builder /app/tsconfig.json /app/ |
| COPY --from=node-builder /app/src /app/src |
| |
| COPY --from=rust-builder /app/rust-engine /app/rust-engine |
|
|
| |
| ENV PORT=7860 |
| ENV NODE_ENV=production |
| |
| ENV HOST=0.0.0.0 |
|
|
| EXPOSE 7860 |
|
|
| |
| |
| CMD ["npx", "tsx", "server.ts"] |
|
|