Skip to content

Commit 885ea38

Browse files
committed
Fixes for Docker and CI
1 parent 66994f2 commit 885ea38

10 files changed

+131
-26
lines changed

.ci-macosx.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ brew update
66
brew install pkg-config
77
brew install opam
88
brew install libev
9-
opam init -y --compiler=4.05.0
9+
opam init -y --compiler=4.12.0
1010
eval $(opam env)
1111

1212
opam install -y -j 2 . --deps-only --locked

.github/workflows/static-builds.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,16 @@ jobs:
4646
sw_vers
4747
system_profiler SPSoftwareDataType
4848
uname -a
49-
# Need unreleased 2.1.0~rc
50-
# - name: Retrieve opam
51-
# run: |
52-
# mkdir "$HOME/bin"
53-
# wget https://github.com/ocaml/opam/releases/download/2.1.0-beta2/opam-2.1.0-beta2-x86_64-macos -O $HOME/bin/opam
54-
# chmod a+x $HOME/bin/opam
55-
# echo "$HOME/bin" >> $GITHUB_PATH
56-
- name: Install latest opam
49+
- name: Retrieve opam
5750
run: |
58-
brew install opam --HEAD
51+
mkdir "$HOME/bin"
52+
wget https://github.com/ocaml/opam/releases/download/2.1.0/opam-2.1.0-x86_64-macos -O $HOME/bin/opam
53+
chmod a+x $HOME/bin/opam
54+
echo "$HOME/bin" >> $GITHUB_PATH
5955
- name: Prepare build environment
6056
run: |
6157
opam init -a --bare
62-
opam switch create . ocaml-base-compiler 'dune<2' --deps-only
58+
opam switch create . ocaml-base-compiler --deps-only
6359
- name: Build the binaries
6460
run: |
6561
opam exec -- make LINKING_MODE=static

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ocaml/opam2:alpine as compilation
1+
FROM ocaml/opam:alpine-3.13-ocaml-4.12 as compilation
22
LABEL Description="learn-ocaml building" Vendor="OCamlPro"
33

44
WORKDIR /home/opam/learn-ocaml
@@ -42,7 +42,7 @@ WORKDIR /learnocaml
4242

4343
COPY --from=compilation /home/opam/install-prefix/bin/learn-ocaml-client /usr/bin
4444

45-
ENTRYPOINT ["dumb-init","learn-ocaml-client"]
45+
ENTRYPOINT ["dumb-init","/usr/bin/learn-ocaml-client"]
4646

4747
LABEL org.opencontainers.image.title="learn-ocaml-client"
4848
LABEL org.opencontainers.image.description="learn-ocaml command-line client"
@@ -68,7 +68,7 @@ WORKDIR /home/learn-ocaml
6868

6969
COPY --from=compilation /home/opam/install-prefix /usr
7070

71-
ENTRYPOINT ["dumb-init","learn-ocaml","--sync-dir=/sync","--repo=/repository"]
71+
ENTRYPOINT ["dumb-init","/usr/bin∕learn-ocaml","--sync-dir=/sync","--repo=/repository"]
7272
CMD ["build","serve"]
7373

7474
LABEL org.opencontainers.image.title="learn-ocaml"

Dockerfile.test-client

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This Dockerfile is useful for testing purposes
22
# to ensure learn-ocaml-client can be built alone from learn-ocaml-client.opam
33

4-
FROM ocaml/opam:alpine-3.13-ocaml-4.05 as compilation
4+
FROM ocaml/opam:alpine-3.13-ocaml-4.12 as compilation
55
LABEL Description="learn-ocaml building" Vendor="OCamlPro"
66

77
WORKDIR learn-ocaml
@@ -13,7 +13,7 @@ RUN sudo chown -R opam:nogroup .
1313
ENV OPAMYES true
1414
RUN echo 'archive-mirrors: [ "https://opam.ocaml.org/cache" ]' >> ~/.opam/config \
1515
&& opam repository set-url default http://opam.ocaml.org \
16-
&& opam switch 4.05 \
16+
&& opam switch 4.12 \
1717
&& echo 'pre-session-commands: [ "sudo" "apk" "add" depexts ]' >> ~/.opam/config \
1818
&& opam pin add -n -y -k path learn-ocaml-client . \
1919
&& opam install learn-ocaml-client --deps-only

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ travis: # From https://stackoverflow.com/questions/21053657/how-to-run-travis-ci
9595
static-binaries:
9696
./scripts/static-build.sh
9797

98-
BINARIES = src/main/learnocaml_client.bc src/main/learnocaml_main.bc src/main/learnocaml_server_main.exe
98+
BINARIES = src/main/learnocaml_client.bc.exe src/main/learnocaml_main.bc.exe src/main/learnocaml_server_main.exe
9999

100100
.PHONY: detect-libs
101101
detect-libs:
@@ -104,6 +104,7 @@ detect-libs:
104104
baseid="detect-libs.$$$$"; echo ...; \
105105
$(MAKE) LINKING_MODE=dynamic OCAMLPARAM="_,verbose=1" > $$baseid.log 2>&1; \
106106
for bin in $(BINARIES); do \
107+
rm -f "_build/default/$$bin"; \
107108
base=$${bin#src/main/}; base=$${base%.*}; \
108109
grep -e "'$$bin'" $$baseid.log > $$baseid.$$base.log; \
109110
printf "%s: " "$$base"; \

learn-ocaml-client.opam.locked

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
opam-version: "2.0"
2+
name: "learn-ocaml-client"
3+
version: "0.12"
4+
synopsis: "The learn-ocaml client"
5+
description: """\
6+
This contains the binaries to interact with the learn-ocaml
7+
platform from the command line."""
8+
maintainer: "Yann Régis-Gianas"
9+
authors: [
10+
"Benjamin Canou (OCamlPro)"
11+
"Çağdaş Bozman (OCamlPro)"
12+
"Grégoire Henry (OCamlPro)"
13+
"Louis Gesbert (OCamlPro)"
14+
"Pierrick Couderc (OCamlPro)"
15+
]
16+
license: "MIT"
17+
homepage: "https://github.com/ocaml-sf/learn-ocaml"
18+
bug-reports: "https://github.com/ocaml-sf/learn-ocaml/issues"
19+
depends: [
20+
"angstrom" {= "0.15.0"}
21+
"asak" {= "0.3"}
22+
"astring" {= "0.8.5"}
23+
"base" {= "v0.14.1"}
24+
"base-bigarray" {= "base"}
25+
"base-bytes" {= "base"}
26+
"base-threads" {= "base"}
27+
"base-unix" {= "base"}
28+
"base64" {= "3.5.0"}
29+
"bigarray-compat" {= "1.0.0"}
30+
"bigstringaf" {= "0.8.0"}
31+
"biniou" {= "1.2.1"}
32+
"cmdliner" {= "1.0.4"}
33+
"cohttp" {= "4.0.0"}
34+
"cohttp-lwt" {= "4.0.0"}
35+
"cohttp-lwt-unix" {= "4.0.0"}
36+
"conduit" {= "1.3.0"}
37+
"conduit-lwt" {= "1.3.0"}
38+
"conduit-lwt-unix" {= "1.3.0"}
39+
"conf-libssl" {= "3"}
40+
"conf-pkg-config" {= "2"}
41+
"conf-which" {= "1"}
42+
"cppo" {= "1.6.7"}
43+
"csexp" {= "1.5.1"}
44+
"cstruct" {= "5.0.0"}
45+
"digestif" {= "1.0.0"}
46+
"dune" {= "2.9.0"}
47+
"dune-configurator" {= "2.9.0"}
48+
"easy-format" {= "1.3.2"}
49+
"eqaf" {= "0.7"}
50+
"ezjsonm" {= "1.1.0"}
51+
"fieldslib" {= "v0.14.0"}
52+
"fmt" {= "0.8.9"}
53+
"gg" {= "0.9.3"}
54+
"hex" {= "1.4.0"}
55+
"ipaddr" {= "2.8.0"}
56+
"jbuilder" {= "1.0+beta20.2"}
57+
"js_of_ocaml" {= "3.9.0"}
58+
"js_of_ocaml-compiler" {= "3.9.1"}
59+
"js_of_ocaml-ppx" {= "3.9.0"}
60+
"jsonm" {= "1.0.1"}
61+
"logs" {= "0.7.0"}
62+
"lwt" {= "5.4.1"}
63+
"lwt_ssl" {= "1.1.3"}
64+
"magic-mime" {= "1.1.3"}
65+
"menhir" {= "20210419"}
66+
"menhirLib" {= "20210419"}
67+
"menhirSdk" {= "20210419"}
68+
"mmap" {= "1.1.0"}
69+
"num" {= "1.4"}
70+
"ocaml" {= "4.12.0"}
71+
"ocaml-compiler-libs" {= "v0.12.3"}
72+
"ocaml-config" {= "2"}
73+
"ocaml-migrate-parsetree" {= "1.8.0"}
74+
"ocaml-options-vanilla" {= "1"}
75+
"ocaml-syntax-shims" {= "1.0.0"}
76+
"ocamlbuild" {= "0.14.0"}
77+
"ocamlfind" {= "1.9.1"}
78+
"ocp-indent-nlfork" {= "1.5.4"}
79+
"ocp-ocamlres" {= "0.4"}
80+
"ocplib-endian" {= "1.1"}
81+
"ocplib-json-typed" {= "0.7.1"}
82+
"omd" {= "1.3.1"}
83+
"parsexp" {= "v0.14.1"}
84+
"pprint" {= "20200410"}
85+
"ppx_derivers" {= "1.2.1"}
86+
"ppx_fields_conv" {= "v0.14.1"}
87+
"ppx_sexp_conv" {= "v0.14.1"}
88+
"ppx_tools" {= "6.3"}
89+
"ppxlib" {= "0.15.0"}
90+
"re" {= "1.9.0"}
91+
"result" {= "1.5"}
92+
"seq" {= "0.2.2"}
93+
"sexplib" {= "v0.14.0"}
94+
"sexplib0" {= "v0.14.0"}
95+
"ssl" {= "0.5.5"}
96+
"stdlib-shims" {= "0.3.0"}
97+
"stringext" {= "1.6.0"}
98+
"topkg" {= "1.0.3"}
99+
"uchar" {= "0.0.2"}
100+
"uri" {= "4.2.0"}
101+
"uri-sexp" {= "4.2.0"}
102+
"uutf" {= "1.0.2"}
103+
"vg" {= "0.9.4"}
104+
"yojson" {= "1.7.0"}
105+
]
106+
build: ["dune" "build" "@install" "-p" name "-j" jobs]
107+
dev-repo: "git+https://github.com/ocaml-sf/learn-ocaml"

learn-ocaml.opam.locked

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ depends: [
7474
"mmap" {= "1.1.0"}
7575
"num" {= "1.4"}
7676
"ocaml" {= "4.12.0"}
77-
"ocaml-base-compiler" {= "4.12.0"}
7877
"ocaml-compiler-libs" {= "v0.12.3"}
7978
"ocaml-config" {= "2"}
8079
"ocaml-migrate-parsetree" {= "1.8.0"}

scripts/static-build.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ cd $(dirname "$0")/..
1010
set -o pipefail
1111
git ls-files -z | xargs -0 tar c | \
1212
docker run --rm -i \
13-
ocamlpro/ocaml:4.05 \
13+
ocamlpro/ocaml:4.12-2021-07-25 \
1414
sh -uexc \
1515
'tar x >&2 &&
16-
sudo apk add openssl-libs-static >&2 &&
17-
opam switch create . ocaml-system "dune<2" --deps-only >&2 &&
16+
sudo apk add openssl-libs-static bash >&2 &&
17+
opam switch create . ocaml-system --deps-only --locked >&2 &&
1818
opam exec make LINKING_MODE=static >&2 &&
1919
tar c -hC _build/install/default/bin .' | \
2020
tar vx

src/main/dune

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@
5656
(rule
5757
(targets linking_main.sexp)
5858
(action (with-stdout-to %{targets}
59-
(run ./linking_flags.sh %{env:LINKING_MODE=dynamic} %{ocaml-config:system} laolao_stubs threads camlrun))))
59+
(run ./linking_flags.sh %{env:LINKING_MODE=dynamic} %{ocaml-config:system} checkseum_c_stubs threads camlrun))))
6060
(rule
6161
(targets linking_client.sexp)
6262
(action (with-stdout-to %{targets}
6363
(run ./linking_flags.sh %{env:LINKING_MODE=dynamic} %{ocaml-config:system} threads camlrun))))
6464
(rule
6565
(targets linking_server.sexp)
6666
(action (with-stdout-to %{targets}
67-
(run ./linking_flags.sh %{env:LINKING_MODE=dynamic} -- laolao_stubs threadsnat))))
67+
(run ./linking_flags.sh %{env:LINKING_MODE=dynamic} -- checkseum_c_stubs threadsnat))))

src/main/linking_flags.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ case $(uname -s) in
4343
Linux)
4444
case $(. /etc/os-release && echo $ID) in
4545
alpine)
46-
COMMON_LIBS="camlstr base_stubs ssl_threads_stubs ssl crypto cstruct_stubs lwt_unix_stubs bigarray unix c"
46+
COMMON_LIBS="camlstr ssl_threads_stubs ssl crypto cstruct_stubs bigstringaf_stubs lwt_unix_stubs unix c"
4747
# `m` and `pthread` are built-in musl
4848
echo '(-noautolink'
49+
echo ' -verbose'
4950
echo ' -cclib -Wl,-Bstatic'
5051
echo ' -cclib -static-libgcc'
5152
for l in $EXTRA_LIBS $COMMON_LIBS; do
@@ -54,14 +55,15 @@ case $(uname -s) in
5455
echo ' -cclib -static)'
5556
;;
5657
*)
57-
echo "Error: static linking is only supported in Alpine, to avoids glibc constraints" >&2
58+
echo "Error: static linking is only supported in Alpine, to avoids glibc constraints (use scripts/static-build.sh to build through an Alpine Docker container)" >&2
5859
exit 3
5960
esac
6061
;;
6162
Darwin)
62-
COMMON_LIBS="camlstr base_stubs ssl_threads_stubs /usr/local/opt/openssl/lib/libssl.a /usr/local/opt/openssl/lib/libcrypto.a cstruct_stubs lwt_unix_stubs bigarray unix"
63+
COMMON_LIBS="camlstr ssl_threads_stubs /usr/local/opt/openssl/lib/libssl.a /usr/local/opt/openssl/lib/libcrypto.a cstruct_stubs bigstringaf_stubs lwt_unix_stubs bigarray unix"
6364
# `m` and `pthread` are built-in in libSystem
6465
echo '(-noautolink'
66+
echo ' -verbose'
6567
for l in $EXTRA_LIBS $COMMON_LIBS; do
6668
if [ "${l%.a}" != "${l}" ]; then echo " -cclib $l"
6769
else echo " -cclib -l$l"

0 commit comments

Comments
 (0)