diff --git a/.forgejo/workflows/test-build.yaml b/.forgejo/workflows/test-build.yaml index e8e8ffedf..66b2fd3a7 100644 --- a/.forgejo/workflows/test-build.yaml +++ b/.forgejo/workflows/test-build.yaml @@ -25,11 +25,7 @@ jobs: - name: Build the shrimp run: | cd /iceshrimp - cp -Trp /iceshrimp-caches/built packages/backend/native-utils/built - cp -Trp /iceshrimp-caches/target packages/backend/native-utils/target yarn build:debug - rm -rf /iceshrimp-caches/built/* && cp -Trp packages/backend/native-utils/built /iceshrimp-caches/built - rm -rf /iceshrimp-caches/target/* && cp -Trp packages/backend/native-utils/target /iceshrimp-caches/target - name: Test the shrimp run: | cd /iceshrimp diff --git a/Dockerfile b/Dockerfile index 459e3ec3b..b298de26a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,17 +4,7 @@ FROM alpine:3.18 as build WORKDIR /iceshrimp # Install compilation dependencies -RUN apk add --no-cache --no-progress git alpine-sdk vips-dev python3 nodejs-current npm rust cargo vips - -# Copy only the cargo dependency-related files first, to cache efficiently -COPY packages/backend/native-utils/Cargo.toml packages/backend/native-utils/Cargo.toml -COPY packages/backend/native-utils/Cargo.lock packages/backend/native-utils/Cargo.lock -COPY packages/backend/native-utils/src/lib.rs packages/backend/native-utils/src/ -COPY packages/backend/native-utils/migration/Cargo.toml packages/backend/native-utils/migration/Cargo.toml -COPY packages/backend/native-utils/migration/src/lib.rs packages/backend/native-utils/migration/src/ - -# Install cargo dependencies -RUN --mount=type=cache,target=/root/.cargo cargo fetch --locked --manifest-path /iceshrimp/packages/backend/native-utils/Cargo.toml +RUN apk add --no-cache --no-progress git alpine-sdk vips-dev python3 nodejs-current npm vips # Copy only the dependency-related files first, to cache efficiently COPY package.json yarn.lock .pnp.cjs .pnp.loader.mjs ./ @@ -23,9 +13,6 @@ COPY packages/client/package.json packages/client/package.json COPY packages/sw/package.json packages/sw/package.json COPY packages/iceshrimp-js/package.json packages/iceshrimp-js/package.json COPY packages/megalodon/package.json packages/megalodon/package.json -COPY packages/backend/native-utils/package.json packages/backend/native-utils/package.json -COPY packages/backend/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/npm/linux-x64-musl/package.json -COPY packages/backend/native-utils/npm/linux-arm64-musl/package.json packages/backend/native-utils/npm/linux-arm64-musl/package.json # Prepare yarn cache COPY .yarn/cache .yarn/cache @@ -40,15 +27,8 @@ RUN --mount=type=cache,target=/iceshrimp/.yarncache rm -rf .yarncache/* && cp -T # Copy in the rest of the files to compile COPY . ./ -# Fix napi-rs jank -RUN --mount=type=cache,target=/iceshrimp/.napi_buildcache cp -Tr /iceshrimp/.napi_buildcache /iceshrimp/packages/backend/native-utils/built -RUN --mount=type=cache,target=/iceshrimp/packages/backend/native-utils/target if [[ ! -f /iceshrimp/packages/backend/native-utils/built/index.js ]]; then rm -rf /iceshrimp/packages/backend/native-utils/target/release; fi - # Build the thing -RUN --mount=type=cache,target=/root/.cargo --mount=type=cache,target=/iceshrimp/packages/backend/native-utils/target env NODE_ENV=production yarn build - -# Fix napi-rs jank (part 2) -RUN --mount=type=cache,target=/iceshrimp/.napi_buildcache cp -Tr /iceshrimp/packages/backend/native-utils/built /iceshrimp/.napi_buildcache +RUN env NODE_ENV=production yarn build # Prepare yarn cache (production) RUN --mount=type=cache,target=/iceshrimp/.yarncache_prod cp -Tr .yarncache_prod .yarn @@ -77,7 +57,6 @@ COPY --from=build /iceshrimp/.yarn /iceshrimp/.yarn COPY --from=build /iceshrimp/built /iceshrimp/built COPY --from=build /iceshrimp/packages/backend/built /iceshrimp/packages/backend/built COPY --from=build /iceshrimp/packages/backend/assets/instance.css /iceshrimp/packages/backend/assets/instance.css -COPY --from=build /iceshrimp/packages/backend/native-utils/built /iceshrimp/packages/backend/native-utils/built RUN corepack enable && corepack prepare yarn@stable --activate ENV NODE_ENV=production diff --git a/docs/install.md b/docs/install.md index 77f3f8922..eb0c45beb 100644 --- a/docs/install.md +++ b/docs/install.md @@ -6,7 +6,6 @@ This document will guide you through manual installation of Iceshrimp on dev bra ### Build -- **Rust** 1.68+ - C/C++ compiler like **GCC** or **Clang** - Build tools like **make** - **Python 3** diff --git a/packages/README.md b/packages/README.md index bbca57472..232f19273 100644 --- a/packages/README.md +++ b/packages/README.md @@ -3,7 +3,6 @@ This directory contains all of the packages Iceshrimp uses. - `backend`: Main backend code written in TypeScript for NodeJS -- `backend/native-utils`: Backend code written in Rust, bound to NodeJS by [NAPI-RS](https://napi.rs/) - `client`: Web interface written in Vue3 and TypeScript - `sw`: Web [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) written in TypeScript - `iceshrimp-js`: TypeScript SDK for both backend and client, also published on [NPM](https://www.npmjs.com/package/iceshrimp-js) for public use