-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEarthfile
94 lines (83 loc) · 2.27 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
VERSION 0.7
PROJECT sjerred/discord-plays-pokemon
ARG --global EARTHLY_CI
ci:
BUILD +image
BUILD +build
BUILD +lint
BUILD +test
build:
BUILD ./packages/backend+build
BUILD ./packages/common+build
BUILD ./packages/frontend+build
lint:
BUILD ./packages/backend+lint
BUILD ./packages/common+lint
BUILD ./packages/frontend+lint
BUILD +markdownlint
BUILD +prettier
test:
BUILD ./packages/backend+test
BUILD ./packages/common+test
BUILD ./packages/frontend+test
prettier:
FROM +deps
COPY . .
IF [ $EARTHLY_CI = "false" ]
RUN npm run prettier:fix
SAVE ARTIFACT ./* AS LOCAL .
ELSE
RUN npm run prettier
END
markdownlint:
FROM davidanson/markdownlint-cli2
COPY . .
IF [ "$EARTHLY_CI" = "false" ]
RUN markdownlint-cli2-fix '**/*.md'
SAVE ARTIFACT ./* AS LOCAL .
ELSE
RUN markdownlint-cli2 '**/*.md'
END
node:
FROM node:lts
WORKDIR /workspace
RUN npm i -g npm
CACHE $(npm config get cache)
deps:
FROM +node
COPY package*.json .
RUN npm ci
image:
FROM --platform=linux/amd64 ghcr.io/selkies-project/nvidia-egl-desktop:20.04-20230906134218
ARG DEBIAN_FRONTEND=noninteractive
USER root
RUN apt update
RUN apt install -y curl kde-config-screenlocker
RUN curl -sL https://deb.nodesource.com/setup_lts.x -o /tmp/nodesource_setup.sh
RUN bash /tmp/nodesource_setup.sh
RUN apt install -y nodejs
WORKDIR /home/user
RUN mkdir -p data
USER user
RUN kwriteconfig5 --file kscreenlockerrc --group Daemon --key Autolock false
RUN kwriteconfig5 --file ~/.config/powermanagementprofilesrc --group AC --group DPMSControl --key idleTime 540
COPY ./packages/backend/package* .
COPY ./packages/backend/+build/ packages/backend/
COPY ./packages/backend/+deps/node_modules node_modules
COPY ./packages/frontend/+build/ packages/frontend/
COPY misc/run.sh .
COPY misc/supervisord.conf .
RUN cat supervisord.conf | sudo tee -a /etc/supervisord.conf
RUN rm supervisord.conf
RUN mkdir Downloads
RUN sudo chown -R user:user Downloads
SAVE IMAGE --push ghcr.io/shepherdjerred/discord-plays-pokemon:latest
up:
LOCALLY
RUN earthly +down
WITH DOCKER --compose misc/compose.yml --load=+image
RUN (cd packages/backend/ && docker compose up -d)
END
down:
LOCALLY
RUN (cd packages/backend/ && docker compose down)