aboutsummaryrefslogtreecommitdiff
path: root/Earthfile
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-12-06 17:36:33 -0800
committerFuwn <[email protected]>2023-12-06 17:37:51 -0800
commit774613a62d09c6d452dca730a55f02be15d56970 (patch)
tree95c4353195a4e002879fc9802eb6f25a9558e52b /Earthfile
parentfeat(manga): mal reading time (diff)
downloaddue.moe-774613a62d09c6d452dca730a55f02be15d56970.tar.xz
due.moe-774613a62d09c6d452dca730a55f02be15d56970.zip
feat(ci): use earthly
Diffstat (limited to 'Earthfile')
-rw-r--r--Earthfile75
1 files changed, 75 insertions, 0 deletions
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