Commit
Author: Kevin Schoon [kevinschoon@gmail.com]
Hash: 45a17b4f863d3e43161e66c404e90109a0ada5da
Timestamp: Wed, 09 Sep 2020 20:43:02 +0000 (4 years ago)

+37 -25 +/-8 browse
build updates WIP
1diff --git a/.gitignore b/.gitignore
2index 7bcace9..2c87c11 100644
3--- a/.gitignore
4+++ b/.gitignore
5 @@ -1,2 +1,3 @@
6 .merlin
7 _build/
8+ pkg
9 diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine
10index a00fbcf..ed99530 100644
11--- a/docker/Dockerfile.alpine
12+++ b/docker/Dockerfile.alpine
13 @@ -2,7 +2,7 @@ FROM ocaml/opam2:alpine
14
15 USER root
16
17- RUN apk --update-cache add m4
18+ RUN apk --update-cache add linux-headers m4
19
20 # install dependencies first to avoid re-installation
21 # when the a non-opam file in the repository changes.
22 @@ -26,7 +26,8 @@ USER opam
23
24 RUN cd /src \
25 && eval "$(opam env)" \
26- && dune build
27+ && dune subst \
28+ && dune build
29
30 FROM alpine:latest
31
32 diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian
33index e7de8d7..2071df3 100644
34--- a/docker/Dockerfile.debian
35+++ b/docker/Dockerfile.debian
36 @@ -26,10 +26,11 @@ USER opam
37
38 RUN cd /src \
39 && eval "$(opam env)" \
40- && dune build
41+ # && dune subst \
42+ # && dune build
43
44- FROM debian:stable
45+ #FROM debian:stable
46
47- COPY --from=0 /src/_build/default/bin/note.exe /usr/bin/note
48+ #COPY --from=0 /src/_build/default/bin/note.exe /usr/bin/note
49
50- ENTRYPOINT ["/usr/bin/note"]
51+ #ENTRYPOINT ["/usr/bin/note"]
52 diff --git a/lib/cmd.ml b/lib/cmd.ml
53index 39ff4d2..abc4439 100644
54--- a/lib/cmd.ml
55+++ b/lib/cmd.ml
56 @@ -298,6 +298,7 @@ note ls
57
58 let run =
59 Command.run
60+ ~version: "%%VERSION%%"
61 (Command.group ~summary:"Note is a simple CLI based note taking application"
62 [
63 ("cat", cat_note);
64 diff --git a/note.opam b/note.opam
65index 482de02..990a468 100644
66--- a/note.opam
67+++ b/note.opam
68 @@ -1,3 +1,4 @@
69+ version: "%%VERSION%%"
70 opam-version: "2.0"
71 version: "0.0.2"
72 synopsis: "Note is a simple CLI based note taking program"
73 diff --git a/scripts/build_docker.sh b/scripts/build_docker.sh
74deleted file mode 100755
75index 297356c..0000000
76--- a/scripts/build_docker.sh
77+++ /dev/null
78 @@ -1,5 +0,0 @@
79- #!/bin/bash
80- set -e
81-
82- docker build -t note-alpine -f docker/Dockerfile.alpine .
83- docker build -t note-debian -f docker/Dockerfile.debian .
84 diff --git a/scripts/extract_build_artifacts.sh b/scripts/extract_build_artifacts.sh
85deleted file mode 100755
86index 9b27d6d..0000000
87--- a/scripts/extract_build_artifacts.sh
88+++ /dev/null
89 @@ -1,14 +0,0 @@
90- #!/bin/bash
91- set -e
92-
93- # TODO: Capture more build specifics
94-
95- musl_container_id="$(docker create note-alpine)"
96- glibc_container_id="$(docker create note-debian)"
97-
98- docker cp "$glibc_container_id:/usr/bin/note" note-glibc-latest
99- docker rm "$glibc_container_id" 1>/dev/null
100- chmod 755 note-glibc-latest
101- docker cp "$musl_container_id:/usr/bin/note" note-musl-latest
102- docker rm "$musl_container_id" 1>/dev/null
103- chmod 755 note-musl-latest
104 diff --git a/scripts/generate_build_artifacts.sh b/scripts/generate_build_artifacts.sh
105new file mode 100755
106index 0000000..3fdb786
107--- /dev/null
108+++ b/scripts/generate_build_artifacts.sh
109 @@ -0,0 +1,26 @@
110+ #!/bin/bash
111+ set -e
112+
113+ VERSION="$(git describe --always)"
114+
115+ # TODO: Capture more build specifics
116+
117+ [[ ! -d "pkg" ]] && mkdir pkg
118+
119+ dune clean
120+
121+ GLIBC_PKG="note-glibc-$VERSION"
122+ MUSL_PKG="note-musl-$VERSION"
123+
124+ docker build -t "$GLIBC_PKG" -f docker/Dockerfile.debian .
125+ # docker build -t "$MUSL_PKG" -f docker/Dockerfile.alpine .
126+
127+ glibc_container_id="$(docker create $GLIBC_PKG)"
128+ #musl_container_id="$(docker create $MUSL_PKG)"
129+
130+ docker cp "$glibc_container_id:/usr/bin/note" "pkg/$GLIBC_PKG"
131+ docker rm "$glibc_container_id" 1>/dev/null
132+ chmod 755 "pkg/$GLIBC_PKG"
133+ #docker cp "$musl_container_id:/usr/bin/note" "$MUSL_PKG"
134+ #docker rm "$musl_container_id" 1>/dev/null
135+ #chmod 755 "$MUSL_PKG"