aboutsummaryrefslogtreecommitdiff
path: root/Earthfile
blob: ec3a71ed8258f01b62b667a4b7ecde50a9fa813d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
VERSION 0.7

FROM oven/bun:1.0.15-alpine

WORKDIR /due

all:
  RUN apk add --update --no-cache git

  COPY .git .git

  BUILD +lint
  BUILD +docker --GIT_SHORT_SHA=$(git rev-parse --short HEAD)

dev:
  LOCALLY
  
  RUN fuser -k 5173/tcp || true
  RUN npm run dev -- --host

lint:
  FROM +source

  COPY .eslintignore .eslintignore
  COPY .eslintrc.cjs .eslintrc.cjs
  COPY .prettierignore .prettierignore
  COPY .prettierrc .prettierrc

  RUN bun --bun run lint
  RUN bun --bun run check

docker:
  ARG GIT_SHORT_SHA

  COPY +build/build .

  RUN echo "PUBLIC_GIT_SHORT_SHA=$GIT_SHORT_SHA" > .env

  CMD ["bun", "--bun", "./index.js"]

  SAVE IMAGE --push fuwn/due-next:latest

build:
  FROM +source

  RUN mkdir data
  RUN sqlite3 data/due_moe.sqlite3 < due_moe_schema.sql
  RUN bun --bun run vite build

  SAVE ARTIFACT build

deps:
  RUN apk add --update --no-cache sqlite-dev

  COPY package.json ./
  COPY bun.lockb ./

  RUN bun install

source:
  FROM +deps

  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
  COPY static static
  COPY src src