-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (34 loc) · 1.76 KB
/
Dockerfile
File metadata and controls
50 lines (34 loc) · 1.76 KB
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
FROM ocaml/opam:debian-12-ocaml-5.2 AS build
ARG NODE_VERSION=v24.11.1
ARG OPAM_VERSION=2.5
ARG DUNE_VERSION=3.20.2
ARG GIT_REV
ENV GIT_REV=$GIT_REV
USER root
RUN apt-get update && apt-get install -y cmake git libev-dev libffi-dev libgmp-dev libssl-dev libsqlite3-dev libpcre3-dev pkg-config
RUN ln -nsf /usr/bin/opam-${OPAM_VERSION} /usr/bin/opam
USER opam
WORKDIR /home/opam/pegasus
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
ENV NVM_DIR=/home/opam/.nvm
ENV CI=true
RUN bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm alias default $NODE_VERSION && nvm use default && corepack enable pnpm"
ADD . .
RUN bash -c "source $NVM_DIR/nvm.sh && pnpm install --frozen-lockfile"
ENV DUNE_CACHE="enabled"
RUN --mount=type=cache,target=/home/opam/.opam/download-cache,uid=1000,gid=1000 \
--mount=type=cache,target=/home/opam/.cache/dune,uid=1000,gid=1000 \
opam install dune.$DUNE_VERSION
RUN --mount=type=cache,target=/home/opam/.cache/dune,uid=1000,gid=1000 \
opam exec dune pkg lock
RUN --mount=type=cache,target=/home/opam/.cache/dune,uid=1000,gid=1000 \
bash -c "source $NVM_DIR/nvm.sh && opam exec dune build -- --release --stop-on-first-error"
FROM debian:12 AS run
RUN apt-get update && apt-get install -y ca-certificates cmake git libev-dev libffi-dev libgmp-dev libssl-dev libsqlite3-dev libpcre3-dev pkg-config netbase
RUN mkdir /data
COPY --from=build /home/opam/pegasus/_build/default/bin/main.exe /bin/pegasus
COPY --from=build /home/opam/pegasus/_build/default/bin/gen_keys.exe /bin/gen-keys
ENTRYPOINT ["/bin/pegasus"]
LABEL org.opencontainers.image.source="https://github.com/futurgh/pegasus"
LABEL org.opencontainers.image.description="pegasus, an atproto pds"
LABEL org.opencontainers.image.licenses=MPL-2.0