diff options
| author | Fuwn <[email protected]> | 2023-12-06 17:36:33 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-12-06 17:37:51 -0800 |
| commit | 774613a62d09c6d452dca730a55f02be15d56970 (patch) | |
| tree | 95c4353195a4e002879fc9802eb6f25a9558e52b | |
| parent | feat(manga): mal reading time (diff) | |
| download | due.moe-774613a62d09c6d452dca730a55f02be15d56970.tar.xz due.moe-774613a62d09c6d452dca730a55f02be15d56970.zip | |
feat(ci): use earthly
| -rw-r--r-- | .dockerignore | 11 | ||||
| -rw-r--r-- | .eslintignore | 1 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .prettierignore | 1 | ||||
| -rw-r--r-- | Dockerfile | 27 | ||||
| -rw-r--r-- | Earthfile | 75 |
6 files changed, 78 insertions, 38 deletions
diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 9af3f70e..00000000 --- a/.dockerignore +++ /dev/null @@ -1,11 +0,0 @@ -** - -!node_modules/ -!src/ -!static/ -!bun.lockb -!due_moe_schema.sql -!package.json -!svelte.config.js -!tsconfig.json -!vite.config.ts
\ No newline at end of file diff --git a/.eslintignore b/.eslintignore index 32781532..35fca122 100644 --- a/.eslintignore +++ b/.eslintignore @@ -12,6 +12,7 @@ # Development Environment .env* *.sqlite3 +.secret # NPM package-lock.json @@ -12,6 +12,7 @@ # Development Environment .env* *.sqlite3 +.secret # NPM package-lock.json diff --git a/.prettierignore b/.prettierignore index 32781532..35fca122 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,6 +12,7 @@ # Development Environment .env* *.sqlite3 +.secret # NPM package-lock.json diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4a2f24ac..00000000 --- a/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM oven/bun:1.0.11 as build - -WORKDIR /due - -RUN apt update -y && apt upgrade -y -RUN apt install sqlite3 -y - -COPY package.json ./ - -RUN bun install - -COPY ./ ./ - -RUN mkdir data -RUN sqlite3 data/due_moe.sqlite3 < due_moe_schema.sql -RUN bun --bun vite build - -FROM oven/bun:1.0.11 - -WORKDIR /due - -COPY --from=build /due/build ./build -COPY --from=build /due/data ./data - -EXPOSE 3000 - -CMD ["bun", "./build/index.js"]
\ No newline at end of file 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 |