Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*

!webapp/**
!bindings/nodejs/**
!bindings/wasm/**
!xlsx/**
!base/**
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:24-alpine AS builder
WORKDIR /app
RUN apk add --no-cache curl build-base python3
RUN curl https://sh.rustup.rs -sSf | sh -s - -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN cargo install wasm-pack
COPY . .
RUN cd /app/bindings/nodejs && npm install && npm run build
RUN npm uninstall tsc && npm install -D typescript && cd /app/bindings/wasm && make
RUN cd /app/webapp/IronCalc && npm install && npm run build
RUN cd /app/webapp/app.ironcalc.com/frontend && npm install && npm run build
RUN cd /app/webapp/app.ironcalc.com/server && cargo build --release


FROM caddy:2.10.0-alpine

RUN apk add build-base musl-dev
COPY --from=builder /app/webapp/app.ironcalc.com/frontend/dist /usr/share/nginx/html
COPY --from=builder /app/webapp/app.ironcalc.com/server/target/release/ironcalc_server /usr/local/bin/ironcalc_server
COPY webapp/app.ironcalc.com/Caddyfile /etc/caddy/Caddyfile
COPY webapp/app.ironcalc.com/server/Rocket.toml .

EXPOSE 2080
9 changes: 7 additions & 2 deletions webapp/app.ironcalc.com/frontend/src/components/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,22 @@ export async function uploadFile(
return blob;
}

const buildApiUrl = (endpoint: string): string => {
const baseUrl: string = import.meta.env.API_BASE_URL || "";
return `${(baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl )}${endpoint}`;
}

export async function get_model(modelHash: string): Promise<Uint8Array> {
return new Uint8Array(
await (await fetch(`/api/model/${modelHash}`)).arrayBuffer(),
await (await fetch(buildApiUrl(`/api/model/${modelHash}`))).arrayBuffer(),
);
}

export async function get_documentation_model(
filename: string,
): Promise<Uint8Array> {
return new Uint8Array(
await (await fetch(`/models/${filename}.ic`)).arrayBuffer(),
await (await fetch(buildApiUrl(`/models/${filename}.ic`))).arrayBuffer(),
);
}

Expand Down
2 changes: 2 additions & 0 deletions webapp/app.ironcalc.com/server/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
target/*
debug/*
.rustc_info.json