Skip to content

Commit

Permalink
#576 earthly
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Oct 2, 2023
1 parent c125a67 commit 87e3c1d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
9 changes: 9 additions & 0 deletions .earthlyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
target
Dockerfile
dockerfile
browser/node_modules
.dockerignore
.env
.git
**/.temp
.gitignore
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"server",
"cli",
Expand Down
18 changes: 8 additions & 10 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
VERSION 0.7
PROJECT applied-knowledge-systems/atomic-server
PROJECT atomicdata-dev/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 main
TRIGGER pr main
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
Expand All @@ -31,8 +30,7 @@ build:
RUN apt update && apt install -y musl-tools musl-dev
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
Expand Down
1 change: 1 addition & 0 deletions browser/.earthlyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
17 changes: 11 additions & 6 deletions browser/Earthfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
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 main
TRIGGER pr main
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
SAVE ARTIFACT data-browser/dist data-browser/dist AS LOCAL dist
2 changes: 2 additions & 0 deletions browser/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 87e3c1d

Please sign in to comment.