-
Notifications
You must be signed in to change notification settings - Fork 76
/
Dockerfile
88 lines (87 loc) · 3.78 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1
FROM ocaml/opam:debian-12-ocaml-4.14@sha256:6246731ea5d2cd3a57669027aae33184d30d424e41ff8219d05a214726ef7426 AS build
RUN sudo ln -sf /usr/bin/opam-2.3 /usr/bin/opam && opam init --reinit -ni
RUN sudo rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' | sudo tee /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt update && sudo apt-get --no-install-recommends install -y \
capnproto \
graphviz \
libev-dev \
libffi-dev \
libgmp-dev \
libsqlite3-dev \
m4 \
pkg-config \
libcapnp-dev
RUN cd ~/opam-repository && git fetch -q origin master && git reset --hard 11bdbee61114a1cfa080b764e71c72a5760a93f0 && opam update
COPY --chown=opam --link \
ocurrent/current_docker.opam \
ocurrent/current_github.opam \
ocurrent/current_git.opam \
ocurrent/current.opam \
ocurrent/current_rpc.opam \
ocurrent/current_slack.opam \
ocurrent/current_web.opam \
/src/ocurrent/
COPY --chown=opam --link \
ocluster/ocluster-api.opam \
ocluster/current_ocluster.opam \
/src/ocluster/
COPY --chown=opam --link \
solver-service/solver-service-api.opam \
solver-service/solver-service.opam \
solver-service/solver-worker.opam \
/src/solver-service/
COPY --chown=opam --link \
ocaml-dockerfile/dockerfile*.opam \
/src/ocaml-dockerfile/
WORKDIR /src
RUN opam pin add -yn current_docker.dev "./ocurrent" && \
opam pin add -yn current_github.dev "./ocurrent" && \
opam pin add -yn current_git.dev "./ocurrent" && \
opam pin add -yn current.dev "./ocurrent" && \
opam pin add -yn current_rpc.dev "./ocurrent" && \
opam pin add -yn current_slack.dev "./ocurrent" && \
opam pin add -yn current_web.dev "./ocurrent" && \
opam pin add -yn current_ocluster.dev "./ocluster" && \
opam pin add -yn dockerfile.dev "./ocaml-dockerfile" && \
opam pin add -yn dockerfile-opam.dev "./ocaml-dockerfile" && \
opam pin add -yn solver-service-api.dev "./solver-service" && \
opam pin add -yn solver-service.dev "./solver-service" && \
opam pin add -yn solver-worker.dev "./solver-service" && \
opam pin add -yn ocluster-api.dev "./ocluster"
COPY --chown=opam --link ocaml-ci.opam ocaml-ci-service.opam ocaml-ci-api.opam /src/
RUN --mount=type=cache,target=/home/opam/.opam/download-cache,sharing=locked,uid=1000,gid=1000 \
opam install -y --deps-only .
ADD --chown=opam . .
RUN opam exec -- dune build ./_build/install/default/bin/ocaml-ci-service
FROM debian:12
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && apt-get --no-install-recommends install -y \
ca-certificates \
curl \
dumb-init \
git \
gnupg2 \
graphviz \
libev4 \
libsqlite3-dev \
netbase \
openssh-client
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN echo 'deb https://download.docker.com/linux/debian bookworm stable' >> /etc/apt/sources.list
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && apt-get --no-install-recommends install -y \
docker-buildx-plugin \
docker-ce
WORKDIR /var/lib/ocurrent
ENTRYPOINT ["dumb-init", "/usr/local/bin/ocaml-ci-service"]
ENV OCAMLRUNPARAM=a=2
# Enable experimental for docker manifest support
ENV DOCKER_CLI_EXPERIMENTAL=enabled
COPY --from=build --link /src/_build/install/default/bin/ocaml-ci-service /src/_build/install/default/bin/solver-service /usr/local/bin/
COPY --from=build --link /src/migrations /migrations