Skip to content

Commit

Permalink
Merge pull request #441 from pfitaxel/add-test
Browse files Browse the repository at this point in the history
fix(*.opam): (Sort &) Fix deps for server/client build in isolation
  • Loading branch information
erikmd authored Oct 9, 2021
2 parents 875b72b + 26a50ef commit e6048f9
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
matrix:
dockerfile:
- 'Dockerfile.test-client'
- 'Dockerfile.test-server'
steps:
- name: Check out the repo
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.test-client
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
FROM ocaml/opam:alpine-3.13-ocaml-4.12 as compilation
LABEL Description="learn-ocaml building" Vendor="OCamlPro"

WORKDIR learn-ocaml
WORKDIR /home/opam/learn-ocaml

# Note: don't copy learn-ocaml.opam.locked
COPY learn-ocaml-client.opam learn-ocaml.opam ./
Expand Down Expand Up @@ -62,4 +62,4 @@ WORKDIR /learnocaml

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

ENTRYPOINT ["dumb-init","learn-ocaml-client"]
ENTRYPOINT ["dumb-init","/usr/bin/learn-ocaml-client"]
70 changes: 70 additions & 0 deletions Dockerfile.test-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This Dockerfile is useful for testing purposes
# to ensure learn-ocaml can be built alone from learn-ocaml.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.locked
COPY learn-ocaml.opam learn-ocaml-client.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 . \
&& opam install learn-ocaml --deps-only --locked

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 --destdir /home/opam/install-prefix \
&& ls -l /home/opam/install-prefix/bin/learn-ocaml


FROM alpine:3.13 as program

ARG BUILD_DATE
ARG VCS_BRANCH
ARG VCS_REF

LABEL org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.name="learn-ocaml" \
org.label-schema.description="learn-ocaml app manager" \
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 git openssl \
&& addgroup learn-ocaml \
&& adduser learn-ocaml -DG learn-ocaml

VOLUME ["/repository"]
RUN mkdir -p /sync && chown learn-ocaml:learn-ocaml /sync
VOLUME ["/sync"]
EXPOSE 8080
EXPOSE 8443

USER learn-ocaml
WORKDIR /home/learn-ocaml

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

ENTRYPOINT ["dumb-init","/usr/bin/learn-ocaml","--sync-dir=/sync","--repo=/repository"]
CMD ["build","serve"]
25 changes: 13 additions & 12 deletions learn-ocaml-client.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,32 @@ homepage: "https://github.com/ocaml-sf/learn-ocaml"
bug-reports: "https://github.com/ocaml-sf/learn-ocaml/issues"
dev-repo: "git+https://github.com/ocaml-sf/learn-ocaml"
depends: [
"base" {>= "v0.9.4"}
"asak"
"base64"
"base" {>= "v0.9.4"}
"cmdliner"
"omd" {<= "1.3.1"}
"asak"
"gg"
"vg"
"cohttp" {>= "2.0.0"}
"cohttp-lwt-unix" {>= "2.0.0"}
"ssl" {= "0.5.5"}
"cstruct" {>= "3.3.0"}
"digestif" {>= "0.7.1"}
"dune"
"dune" {>= "1.11.4"}
"ezjsonm"
"gg"
"ipaddr" {= "2.8.0" }
"lwt" {>= "4.0.0"}
"lwt_ssl"
"ocaml" {(>= "4.12") & (< "4.13~")}
"ocamlfind" {build}
"ocp-indent-nlfork"
"ocp-ocamlres" {>= "0.4"}
"ocplib-json-typed" {>= "0.7"}
"ipaddr" {= "2.8.0" }
"cstruct" {>= "3.3.0"}
"ppx_tools"
"ppx_sexp_conv"
"ocp-ocamlres" {>= "0.4"}
"omd" {<= "1.3.1"}
"ppx_fields_conv"
"ppxlib"
"ppx_sexp_conv"
"ppx_tools"
"ssl" {= "0.5.5"}
"vg"
]
build: [
["dune" "build" "@install" "-p" name "-j" jobs]
Expand Down
19 changes: 11 additions & 8 deletions learn-ocaml.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ homepage: "https://github.com/ocaml-sf/learn-ocaml"
bug-reports: "https://github.com/ocaml-sf/learn-ocaml/issues"
dev-repo: "git+https://github.com/ocaml-sf/learn-ocaml"
depends: [
"base" {>= "v0.9.4"}
"asak"
"base64"
"base" {>= "v0.9.4"}
"cmdliner"
"cohttp" {>= "2.0.0"}
"cohttp-lwt" {>= "2.0.0"}
Expand All @@ -25,8 +26,8 @@ depends: [
"digestif" {>= "0.7.1"}
"dune" {>= "1.11.4"}
"easy-format" {>= "1.3.0" }
"ipaddr" {>= "2.8.0" }
"ezjsonm"
"ipaddr" {>= "2.8.0" }
"js_of_ocaml" {>= "3.3.0" & != "3.10.0"}
"js_of_ocaml-compiler" {>= "3.3.0"}
"js_of_ocaml-lwt"
Expand All @@ -36,26 +37,28 @@ depends: [
"lwt" {>= "4.0.0"}
"lwt_react"
"lwt_ssl"
"ssl" {= "0.5.5"}
"magic-mime"
"markup"
"markup-lwt"
"ocaml" {(>= "4.12") & (< "4.13~")}
"ocamlfind" {build}
"ocp-indent-nlfork"
"ocp-ocamlres" {= "0.4"}
"ocplib-json-typed" {>= "0.6"}
"ocplib-json-typed-browser" {>= "0.6"}
"ocplib-json-typed" {>= "0.7"}
"ocplib-json-typed-browser" {>= "0.7"}
"ocp-ocamlres" {>= "0.4"}
"odoc" {build}
"omd"
"omd" {<= "1.3.1"}
"pprint"
"ppx_cstruct"
"ppxlib"
"ppx_sexp_conv"
"ppx_tools"
"ppx_tools_versioned"
"re"
"ssl" {= "0.5.5"}
"uutf" {>= "1.0" }
"vg"
"yojson" {>= "1.4.0" }
"asak" {>= "0.1"}
]
build: [
[make "static"]
Expand Down

0 comments on commit e6048f9

Please sign in to comment.