Skip to content
Merged
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
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ jobs:
- uses: taiki-e/install-action@v2
with:
tool: trunk
- name: Build
- name: Build UI first
run: |
cd roapi-ui
trunk build --release
- name: Build ROAPI with UI
run: |
mold -run cargo build --features=ui

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/roapi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ jobs:
tool: trunk
- name: Install maturin
run: pip3 install 'maturin<2'
- name: Build UI first
run: |
cd roapi-ui
trunk build --release
- name: Build wheels - x86_64
run: |
maturin build -m roapi/Cargo.toml -b bin --target x86_64-apple-darwin --release --out dist --features=database-sqlite,ui
Expand Down Expand Up @@ -106,6 +110,10 @@ jobs:
tool: trunk
- name: Install maturin
run: pip3 install 'maturin<2'
- name: Build UI first
run: |
cd roapi-ui
trunk build --release
- name: Build wheels
run: |
maturin build -m roapi/Cargo.toml -b bin --release --out dist --target ${{ matrix.platform.target }} --features=${{ matrix.platform.features }},ui
Expand Down Expand Up @@ -198,6 +206,10 @@ jobs:
run: |
apt-get update
apt-get install -y libssl-dev
- name: Build UI first
run: |
cd roapi-ui
trunk build --release
- name: Build Wheels
run: |
sudo python3 -m pip install 'maturin<2'
Expand Down
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ FROM rust:${RUST_VER} AS chef
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
RUN cargo binstall trunk

# Add WebAssembly target for UI build
RUN rustup target add wasm32-unknown-unknown

# We only pay the installation cost once,
# it will be cached from the second build onwards
RUN cargo binstall cargo-chef
Expand All @@ -27,18 +30,21 @@ WORKDIR /roapi_src
COPY --from=planner /roapi_src/recipe.json recipe.json
RUN cargo chef cook --features ${FEATURES} --release --recipe-path recipe.json

# Step 3: Build the release binary
# Step 3: Build the UI and release binary
FROM chef AS builder
ARG FEATURES
WORKDIR /roapi_src
COPY ./ /roapi_src
COPY --from=cacher /roapi_src/target target
COPY --from=cacher /usr/local/cargo /usr/local/cargo
# First build the UI
RUN cd roapi-ui && trunk build --release
# Then build the ROAPI binary with the UI embedded
RUN cargo build --release --locked --bin roapi --features ${FEATURES}

# Step 4: Assemble the final image
FROM debian:bookworm-slim
LABEL org.opencontainers.image.source https://github.com/roapi/roapi
LABEL org.opencontainers.image.source=https://github.com/roapi/roapi

RUN apt-get update \
&& apt-get install -y libssl-dev ca-certificates \
Expand Down
35 changes: 0 additions & 35 deletions roapi/build.rs

This file was deleted.

2 changes: 2 additions & 0 deletions roapi/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ pub fn get_cmd() -> clap::Command {
"snmalloc",
#[cfg(feature = "rustls")]
"rustls",
#[cfg(feature = "ui")]
"ui",
];

clap::Command::new("roapi")
Expand Down