Skip to content

Commit 5c49161

Browse files
mmaehrenApolloLV
andauthored
Cherrypick Ocaml Changes (#95)
* Support more than one ocamltls version * Further ocamltls fixes * Even more fixes * Try installing external dependencies as well * Try another dependency approach * Try yet another dependency approach * Instead of building from scratch, use a precompiled version * Fix edit error * Install m4 before opam * libgmp changes so file name * Try with regular libgmp * Add debugging output * Try getting libgmp from /usr/lib * hybrid approach * Fix typo * explicitly install pkg-config * Use new build script * Use topkg build command * Add topkg care as a dependency * Trying another building approach * Trying another building approach * Remove leftover sed call * Running dune properly * Changing hardcoded certificate path * Removing default certificate files * Try the echo_server instead of the test_server * Try the fuzz_server instead of the test_server --------- Co-authored-by: Jan Drees <jan.drees@uni-wuppertal.de>
1 parent 34bd0c0 commit 5c49161

File tree

2 files changed

+41
-13
lines changed

2 files changed

+41
-13
lines changed

images/ocamltls/Dockerfile

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
FROM ocaml/opam as ocamltls-base1
2-
RUN sudo apt install -y libgmp-dev
3-
RUN git clone --depth=1 --branch=0.8.0 https://github.com/mirleft/ocaml-tls
2+
ARG VERSION
3+
RUN sudo apt install -y libgmp-dev m4 pkg-config
4+
WORKDIR /home/opam/opam-repository
5+
RUN git checkout -B master origin/master
6+
RUN opam update
7+
RUN git clone --depth=1 --branch=${VERSION} https://github.com/mirleft/ocaml-tls
48
WORKDIR /home/opam/ocaml-tls
9+
RUN sed -i -e 's~\./certificates/server\.pem~/cert/rsa2048cert\.pem~g' lwt/examples/ex_common.ml
10+
RUN sed -i -e 's~\./certificates/server\.key~/cert/rsa2048key\.pem~g' lwt/examples/ex_common.ml
511
RUN eval `opam config env` &&\
6-
opam install -y topkg cstruct nocrypto x509 ppx_cstruct oUnit cstruct-unix
12+
opam install -y topkg topkg-care cstruct nocrypto x509 ppx_cstruct oUnit cstruct-unix
713
RUN eval `opam config env` &&\
8-
ocaml pkg/pkg.ml build --with-lwt true
14+
opam install .
15+
RUN eval `opam config env` &&\
16+
dune build lwt/examples/fuzz_server.exe
17+
RUN eval `opam config env` &&\
18+
dune build lwt/examples/test_client.exe
19+
920

1021
FROM entrypoint as ocamltls-base2
1122
COPY --from=ocamltls-base1 /lib/x86_64-linux-gnu/libdl.so.2 \
1223
/lib/x86_64-linux-gnu/librt.so.1 \
1324
/lib/x86_64-linux-gnu/libpthread.so.0 \
1425
/lib/x86_64-linux-gnu/libgcc_s.so.1 \
15-
/lib/x86_64-linux-gnu/libgmp.so.10 \
26+
/usr/lib/x86_64-linux-gnu/libgmp.so.10 \
1627
/lib/x86_64-linux-gnu/libm.so.6 \
1728
/lib/x86_64-linux-gnu/libc.so.6 /lib/
1829
COPY --from=ocamltls-base1 /lib64/ld-linux-x86-64.so.2 /lib64/
1930

2031
FROM ocamltls-base2 as ocamltls-server
2132
LABEL "tls_implementation"="ocamltls"
22-
LABEL "tls_implementation_version"="0.8.0"
33+
LABEL "tls_implementation_version"="${VERSION}"
2334
LABEL "tls_implementation_connectionRole"="server"
24-
COPY --from=ocamltls-base1 /home/opam/ocaml-tls/_build/lwt/examples/test_server.native /bin/
25-
ENTRYPOINT ["server-entrypoint", "test_server.native"]
35+
COPY --from=ocamltls-base1 /home/opam/ocaml-tls/_build/default/lwt/examples/fuzz_server.exe /bin/
36+
ENTRYPOINT ["server-entrypoint", "fuzz_server.exe"]
2637

2738
FROM ocamltls-base2 as ocamltls-client
2839
LABEL "tls_implementation"="ocamltls"
29-
LABEL "tls_implementation_version"="0.8.0"
40+
LABEL "tls_implementation_version"="${VERSION}"
3041
LABEL "tls_implementation_connectionRole"="client"
31-
COPY --from=ocamltls-base1 /home/opam/ocaml-tls/_build/lwt/examples/test_client.native /bin/
32-
ENTRYPOINT ["client-entrypoint", "test_client.native"]
42+
COPY --from=ocamltls-base1 /home/opam/ocaml-tls/_build/default/lwt/examples/test_client.exe /bin/
43+
ENTRYPOINT ["client-entrypoint", "test_client.exe"]

images/ocamltls/ocamltls.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@
22
cd "$(dirname "$0")" || exit 1
33
source ../helper-functions.sh
44

5-
_docker build -t ${DOCKER_REPOSITORY}ocamltls-server:0.8.0 --target ocamltls-server .
6-
_docker build -t ${DOCKER_REPOSITORY}ocamltls-client:0.8.0 --target ocamltls-client .
5+
array=(0.12.8 0.10.5)
6+
typeset -i i=0 max=${#array[*]}
7+
while (( i < max ))
8+
do
9+
echo "Build OCaml-TLS ${array[$i]}:"
10+
_docker build --build-arg VERSION=v${array[$i]} -t ${DOCKER_REPOSITORY}ocamltls-server:${array[$i]} -f Dockerfile --target ocamltls-server .
11+
_docker build --build-arg VERSION=v${array[$i]} -t ${DOCKER_REPOSITORY}ocamltls-client:${array[$i]} -f Dockerfile --target ocamltls-client .
12+
i=i+1
13+
done
14+
15+
array=(0.10.4 0.8.0)
16+
typeset -i i=0 max=${#array[*]}
17+
while (( i < max ))
18+
do
19+
echo "Build OCaml-TLS ${array[$i]}:"
20+
_docker build --build-arg VERSION=${array[$i]} -t ${DOCKER_REPOSITORY}ocamltls-server:${array[$i]} -f Dockerfile --target ocamltls-server .
21+
_docker build --build-arg VERSION=${array[$i]} -t ${DOCKER_REPOSITORY}ocamltls-client:${array[$i]} -f Dockerfile --target ocamltls-client .
22+
i=i+1
23+
done
724

825
exit "$EXITCODE"

0 commit comments

Comments
 (0)