tangled
alpha
login
or
join now
8bit.lol
/
pegasus
forked from
futur.blue/pegasus
0
fork
atom
objective categorical abstract machine language personal data server
0
fork
atom
overview
issues
pulls
pipelines
Get Docker builds working
futur.blue
3 months ago
c48efaf4
05a9444d
verified
This commit was signed with the committer's
known signature
.
futur.blue
SSH Key Fingerprint:
SHA256:QHGqHWNpqYyw9bt8KmPuJIyeZX9SZewBZ0PR1COtKQ0=
+58
-12
11 changed files
expand all
collapse all
unified
split
.dockerignore
.gitignore
Dockerfile
bin
dune
main.ml
dune
dune-project
dune-workspace
frontend
build.mjs
pegasus
lib
migrations.ml
pegasus.opam
+3
.dockerignore
···
7
7
8
8
_opam/
9
9
_build/
10
10
+
node_modules/
10
11
*.lock
11
12
*.locks
13
13
+
*.env
14
14
+
*.install
12
15
13
16
Dockerfile
14
17
docker-compose.yml
+1
.gitignore
···
4
4
_test_boot
5
5
dune.lock
6
6
dev-tools.locks
7
7
+
*.install
7
8
8
9
node_modules
9
10
+19
-5
Dockerfile
···
1
1
FROM --platform=linux/amd64 ocaml/opam:debian-12-ocaml-5.2 AS build
2
2
3
3
+
ARG NODE_VERSION=v24.11.1
4
4
+
ARG DUNE_VERSION=3.20.2
5
5
+
3
6
RUN sudo apt-get install -y cmake git libev-dev libffi-dev libgmp-dev libssl-dev libsqlite3-dev pkg-config
4
7
5
5
-
WORKDIR /home/opam
8
8
+
WORKDIR /home/opam/pegasus
6
9
7
7
-
RUN curl -fsSL https://get.dune.build/install | sh
10
10
+
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
11
11
+
12
12
+
ENV NVM_DIR=/home/opam/.nvm
13
13
+
ENV CI=true
14
14
+
15
15
+
RUN bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm alias default $NODE_VERSION && nvm use default && corepack enable pnpm"
16
16
+
17
17
+
RUN bash -c "curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh | bash -s -- --dev"
18
18
+
RUN opam install dune.$DUNE_VERSION
8
19
9
20
ENV PATH="/home/opam/.local/bin:${PATH}"
10
21
ENV DUNE_CACHE="enabled"
11
22
12
23
ADD . .
13
13
-
RUN dune pkg lock
14
14
-
RUN dune build
24
24
+
25
25
+
RUN bash -c "source $NVM_DIR/nvm.sh && pnpm install --frozen-lockfile"
26
26
+
27
27
+
RUN opam exec dune pkg lock
28
28
+
RUN bash -c "source $NVM_DIR/nvm.sh && opam exec dune build -- --release --stop-on-first-error"
15
29
16
30
FROM --platform=linux/amd64 ocaml/opam:debian-12-ocaml-5.2 AS run
17
31
18
32
RUN sudo apt-get install -y libev-dev
19
33
20
20
-
COPY --from=build /home/opam/_build/default/bin/main.exe /bin/pegasus
34
34
+
COPY --from=build /home/opam/pegasus/_build/default/bin/main.exe /bin/pegasus
21
35
22
36
ENTRYPOINT ["/bin/pegasus"]
bin/dune
+6
-1
bin/main.ml
···
83
83
, "/xrpc/com.atproto.actor.putPreferences"
84
84
, Api.Actor.PutPreferences.handler ) ]
85
85
86
86
+
let public_loader _root path _request =
87
87
+
match Public.read path with
88
88
+
| None -> Dream.empty `Not_Found
89
89
+
| Some asset -> Dream.respond asset
90
90
+
86
91
let static_routes =
87
87
-
[Dream.get "/public/**" (Dream.static "_build/default/public")]
92
92
+
[Dream.get "/public/**" (Dream.static ~loader:public_loader "")]
88
93
89
94
let main =
90
95
let%lwt db = Data_store.connect ~create:true () in
+14
-3
dune
···
26
26
(deps
27
27
(:script ../frontend/build.mjs)
28
28
(:entrypoints ../frontend/client/client/frontend/client/client.js)
29
29
-
(source_tree ../frontend/client)
30
30
-
(source_tree ../frontend/src))
29
29
+
(alias_rec ../frontend/melange)
30
30
+
(package frontend))
31
31
(action
32
32
(run
33
33
node
···
35
35
%{entrypoints}
36
36
--output=./client.js
37
37
--extract=true
38
38
-
--env=%{env:NODE_ENV='production'}))))
38
38
+
--env=%{profile}))))
39
39
+
40
40
+
(subdir
41
41
+
bin/
42
42
+
(rule
43
43
+
(target public.ml)
44
44
+
(deps
45
45
+
(file ../public/client.js)
46
46
+
(file ../public/index.css)
47
47
+
(source_tree ../public/fonts))
48
48
+
(action (with-stdout-to %{null}
49
49
+
(run ocaml-crunch -e woff -e woff2 -e js -e css -m plain ../public -o %{target})))))
+1
dune-project
···
69
69
ppx_rapper
70
70
ppx_rapper_lwt
71
71
(alcotest :with-test)
72
72
+
crunch
72
73
(ocamlformat-mlx :with-dev-setup)
73
74
(ocamlmerlin-mlx :with-dev-setup)))
74
75
+11
dune-workspace
···
1
1
+
(lang dune 3.20)
2
2
+
3
3
+
(lock_dir
4
4
+
(path dune.lock)
5
5
+
(solve_for_platforms
6
6
+
((arch arm64)
7
7
+
(os macos))
8
8
+
((arch arm64)
9
9
+
(os linux))
10
10
+
((arch x86_64)
11
11
+
(os linux))))
+1
-1
frontend/build.mjs
···
7
7
const outdir = path.dirname(outfile);
8
8
const splitting = true;
9
9
10
10
-
const isDev = env === "development";
10
10
+
const isDev = env === "dev";
11
11
12
12
try {
13
13
const result = await viteBuild({
+1
pegasus.opam
···
30
30
"ppx_rapper"
31
31
"ppx_rapper_lwt"
32
32
"alcotest" {with-test}
33
33
+
"crunch"
33
34
"ocamlformat-mlx" {with-dev-setup}
34
35
"ocamlmerlin-mlx" {with-dev-setup}
35
36
"odoc" {with-doc}
+1
-2
pegasus/lib/migrations.ml
···
105
105
List.filter (fun (id, _, _) -> not (List.mem id applied)) available
106
106
in
107
107
match pending with
108
108
-
| [] ->
109
109
-
Lwt_io.printl "no pending migrations"
108
108
+
| [] -> Lwt.return_unit
110
109
| _ ->
111
110
let%lwt () =
112
111
Lwt_io.printlf "found %d pending migrations" (List.length pending)