From 774613a62d09c6d452dca730a55f02be15d56970 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 6 Dec 2023 17:36:33 -0800 Subject: feat(ci): use earthly --- Earthfile | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Earthfile (limited to 'Earthfile') diff --git a/Earthfile b/Earthfile new file mode 100644 index 00000000..08d82da9 --- /dev/null +++ b/Earthfile @@ -0,0 +1,75 @@ +VERSION 0.7 + +FROM oven/bun:1.0.11 + +WORKDIR /due + +deps: + RUN apt update -y + RUN apt upgrade -y + RUN apt install sqlite3 -y + + COPY package.json ./ + COPY bun.lockb ./ + + RUN bun install + + SAVE ARTIFACT package.json AS LOCAL ./package.json + SAVE ARTIFACT bun.lockb AS LOCAL ./bun.lockb + +source: + FROM +deps + + COPY src src + COPY static static + COPY due_moe_schema.sql due_moe_schema.sql + COPY svelte.config.js svelte.config.js + COPY tsconfig.json tsconfig.json + COPY vite.config.ts vite.config.ts + +dev: + FROM +source + + CMD ["bun", "--bun", "run", "dev", "--host"] + + SAVE IMAGE fuwn/due-next-dev:latest + +rundev: + FROM docker:24.0.7-dind + + WITH DOCKER --load +dev + RUN docker run --network=host \ + # -v $PWD/src:/due/src \ + # -v $PWD/static:/due/static \ + # -v $PWD/due_moe_schema.sql:/adue/due_moe_schema.sql \ + # -v $PWD/svelte.config.js:/app/svelte.config.js \ + # -v $PWD/tsconfig.json:/app/tsconfig.json \ + # -v $PWD/vite.config.ts:/app/vite.config.ts \ + fuwn/due-next-dev:latest + END + +lint: + FROM +source + + COPY .eslintignore .eslintignore + COPY .eslintrc.cjs .eslintrc.cjs + COPY .prettierignore .prettierignore + COPY .prettierrc .prettierrc + + RUN bun --bun run check + +build: + FROM +source + + RUN mkdir data + RUN sqlite3 data/due_moe.sqlite3 < due_moe_schema.sql + RUN bun --bun vite build + + SAVE IMAGE + +docker: + FROM +build + + CMD ["bun", "--bun", "./build/index.js"] + + SAVE IMAGE fuwn/due-next:latest -- cgit v1.2.3