forked from ocaml-sf/learn-ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.test-client
65 lines (49 loc) · 1.99 KB
/
Dockerfile.test-client
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
# This Dockerfile is useful for testing purposes
# to ensure learn-ocaml-client can be built alone from learn-ocaml-client.opam
FROM ocaml/opam:alpine-3.13-ocaml-4.12 as compilation
LABEL Description="learn-ocaml building" Vendor="OCamlPro"
WORKDIR /home/opam/learn-ocaml
# Note: don't copy learn-ocaml.opam.locked
COPY learn-ocaml-client.opam learn-ocaml.opam ./
RUN sudo chown -R opam:nogroup .
ENV OPAMYES true
RUN echo 'archive-mirrors: [ "https://opam.ocaml.org/cache" ]' >> ~/.opam/config \
&& opam repository set-url default http://opam.ocaml.org \
&& opam switch 4.12 \
&& echo 'pre-session-commands: [ "sudo" "apk" "add" depexts ]' >> ~/.opam/config \
&& opam pin add -n -y -k path learn-ocaml-client . \
&& opam install learn-ocaml-client --deps-only
COPY static static
COPY translations translations
COPY src src
COPY scripts scripts
COPY Makefile Makefile
COPY demo-repository demo-repository
COPY dune-project dune-project
COPY dune dune
RUN sudo chown -R opam:nogroup .
ENV OPAMVERBOSE 1
RUN opam install learn-ocaml-client --destdir /home/opam/install-prefix \
&& ls -l /home/opam/install-prefix/bin/learn-ocaml-client
FROM alpine:3.13 as client
ARG BUILD_DATE
ARG VCS_BRANCH
ARG VCS_REF
LABEL org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.name="learn-ocaml-client" \
org.label-schema.description="learn-ocaml command-line client" \
org.label-schema.url="https://ocaml-sf.org/" \
org.label-schema.vendor="The OCaml Software Foundation" \
org.label-schema.version="${VCS_BRANCH}" \
org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.vcs-url="https://github.com/ocaml-sf/learn-ocaml" \
org.label-schema.schema-version="1.0"
RUN apk update \
&& apk add ncurses-libs libev dumb-init openssl \
&& addgroup learn-ocaml \
&& adduser learn-ocaml -DG learn-ocaml
VOLUME ["/learnocaml"]
USER learn-ocaml
WORKDIR /learnocaml
COPY --from=compilation /home/opam/install-prefix/bin/learn-ocaml-client /usr/bin
ENTRYPOINT ["dumb-init","/usr/bin/learn-ocaml-client"]