diff --git a/.earthlyignore b/.earthlyignore new file mode 100644 index 000000000..558afe7c3 --- /dev/null +++ b/.earthlyignore @@ -0,0 +1,9 @@ +target +Dockerfile +dockerfile +browser/node_modules +.dockerignore +.env +.git +**/.temp +.gitignore diff --git a/Cargo.toml b/Cargo.toml index 278d69296..8697a07eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "server", "cli", diff --git a/Earthfile b/Earthfile index 7065b1513..8b7598f3c 100644 --- a/Earthfile +++ b/Earthfile @@ -1,25 +1,25 @@ VERSION 0.7 -PROJECT applied-knowledge-systems/atomic-server +PROJECT ontola/atomic-server # You can compile front end separately and copy dist folder -# IMPORT ./browser AS browser +IMPORT ./browser AS browser FROM rust:latest WORKDIR /code main-pipeline: - PIPELINE --push - TRIGGER push main - TRIGGER pr main + PIPELINE --push + TRIGGER push develop + TRIGGER push main + TRIGGER pr develop ARG tag=latest BUILD +build --tag=$tag deps: - RUN curl -fsSL https://bun.sh/install | bash - RUN /root/.bun/bin/bun install -y pnpm + RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh - # COPY . . COPY --dir server lib cli desktop Cargo.lock Cargo.toml . # RUN mkdir src # RUN touch src/main.rs # adding main.rs stub so cargo fetch works to prepare the cache - RUN cargo fetch + RUN cargo fetch test: FROM +deps @@ -28,11 +28,10 @@ test: build: FROM +deps RUN rustup target add x86_64-unknown-linux-musl - RUN apt update && apt install -y musl-tools musl-dev + RUN apt update && apt install -y musl-tools musl-dev g++-x86-64-linux-gnu libc6-dev-amd64-cross RUN update-ca-certificates WORKDIR /app - # FIXME: Joep you need to fix this line and modify Earthfile inside browser - # COPY browser+build/dist ./public + COPY browser+build/data-browser/dist /app/browser/data-browser/dist COPY --dir server lib cli desktop Cargo.lock Cargo.toml . RUN cargo build --release --bin atomic-server --config net.git-fetch-with-cli=true --target x86_64-unknown-linux-musl RUN strip -s /app/target/x86_64-unknown-linux-musl/release/atomic-server diff --git a/browser/.earthlyignore b/browser/.earthlyignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/browser/.earthlyignore @@ -0,0 +1 @@ +node_modules diff --git a/browser/Earthfile b/browser/Earthfile index 1e7313b31..2aa92b15b 100644 --- a/browser/Earthfile +++ b/browser/Earthfile @@ -1,22 +1,28 @@ VERSION 0.7 -PROJECT applied-knowledge-systems/atomic-server +PROJECT atomicdata-dev/atomic-server FROM node:latest WORKDIR browser main-pipeline: - PIPELINE --push - TRIGGER push main - TRIGGER pr main + PIPELINE --push + TRIGGER push develop + TRIGGER push main + TRIGGER pr develop ARG tag=latest BUILD +build --tag=$tag deps: RUN curl -f https://get.pnpm.io/v6.14.js | node - add --global pnpm + COPY package.json pnpm-lock.yaml . + # COPY data-browser/package.json data-browser/. + # COPY lib/package.json lib/. + # COPY react/package.json react/. + RUN pnpm recursive install --frozen-lockfile --shamefully-hoist COPY . . - RUN pnpm install --no-frozen-lockfile + RUN pnpm install SAVE ARTIFACT node_modules /node_modules build: FROM +deps RUN pnpm run build - SAVE ARTIFACT dist /dist AS LOCAL dist \ No newline at end of file + SAVE ARTIFACT data-browser/dist data-browser/dist AS LOCAL dist diff --git a/browser/tsconfig.build.json b/browser/tsconfig.build.json index 2a653a266..5fd88634b 100644 --- a/browser/tsconfig.build.json +++ b/browser/tsconfig.build.json @@ -3,6 +3,8 @@ "target": "ES5", "module": "ES2022", "lib": [ + // Not sure if DOM should be here. Lib should also work without a browser! + "DOM", "ES6", "ES7", "ESNext"