-
Notifications
You must be signed in to change notification settings - Fork 903
/
Earthfile
52 lines (45 loc) · 1.89 KB
/
Earthfile
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
VERSION --use-visited-upfront-hash-collection 0.7
FROM node:20
WORKDIR /contrib/web
src-files:
COPY ../config+src-files/* ../config
COPY package.json .
COPY pnpm-lock.yaml .
api-files:
COPY geo/world.geojson ./geo/world.geojson
COPY public/locales/en.json ./public/locales/en.json
SAVE ARTIFACT .
prepare:
FROM +src-files
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile
COPY index.html .postcssrc.json tailwind.config.cjs tsconfig.json tsconfig.node.json vite.config.cts .
COPY scripts/generateZonesConfig.ts ./scripts/generateZonesConfig.ts
COPY scripts/register-tsNodeESM.js ./scripts/register-tsNodeESM.js
COPY --dir geo public src ./
test:
FROM +prepare
COPY ../+linting-files/* ../
COPY .gitignore .eslintrc.json .prettierrc.json viteEnvironment.d.ts testSetup.ts .
COPY --dir cypress ./
RUN pnpm run create-generated-files
RUN pnpm run validate
# TODO: Enable Cypress tests later
# RUN pnpm run cy:test-all
build:
FROM +prepare
RUN pnpm run create-generated-files
RUN pnpm version minor
RUN --secret SENTRY_AUTH_TOKEN --secret VITE_PUBLIC_ELECTRICITYMAP_PUBLIC_TOKEN=ELECTRICITYMAP_PUBLIC_TOKEN pnpm run build
# Local outputs for debugging
SAVE ARTIFACT ./config/world.json AS LOCAL ./config/world.json
SAVE ARTIFACT ./config/usa_states.json AS LOCAL ./config/usa_states.json
SAVE ARTIFACT ./config/excluded_aggregated_exchanges.json AS LOCAL ./config/excluded_aggregated_exchanges.json
# NOTE: We could consider dropping source maps from dist since it has already been uploaded to Sentry at this point
SAVE ARTIFACT ./dist AS LOCAL ./dist
deploy:
FROM +prepare
COPY +build/dist ./dist
RUN npm install -g wrangler
# TODO: Point to master after build and deploy has been tested to staging
RUN --push --secret CLOUDFLARE_API_TOKEN --secret CLOUDFLARE_ACCOUNT_ID wrangler pages publish ./dist --project-name electricitymaps-app --branch master