Skip to content

Commit

Permalink
Add ubuntu binary docker release and update script (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
rvantonder authored Nov 6, 2019
1 parent 67db719 commit 030470f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
6 changes: 5 additions & 1 deletion comby.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bug-reports: "https://github.com/comby-tools/comby/issues"
dev-repo: "git+https://github.com/comby-tools/comby.git"
license: "Apache-2.0"
build: [
["jbuilder" "build" "-p" name "-j" jobs "@install"]
["dune" "build" "-p" name "-j" jobs "@install"]
]
depends: [
"ocaml" {>= "4.08.1"}
Expand Down Expand Up @@ -39,10 +39,14 @@ depexts: [
[
"pkg-config"
"libpcre3-dev"
"zlib1g-dev"
"m4"
"libgmp-dev"
] {os-distribution = "ubuntu"}
[
"pkg-config"
"pcre"
"gmp"
] {os-distribution = "macos"}
]
synopsis: "A tool for changing code across many languages"
Expand Down
29 changes: 29 additions & 0 deletions dockerfiles/ubuntu/binary-release/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ocaml/opam2:ubuntu-18.04-opam

WORKDIR /home/comby

RUN sudo apt-get install -y \
libpcre3-dev \
pkg-config \
zlib1g-dev \
m4 \
libgmp-dev

RUN opam init --no-setup --disable-sandboxing --compiler=4.09.0

COPY Makefile /home/comby/
COPY comby.opam /home/comby/
COPY dune /home/comby/
COPY docs /home/comby/docs
COPY src /home/comby/src
COPY lib /home/comby/lib
COPY test /home/comby/test
COPY push-coverage-report.sh /home/comby/

RUN sudo chown -R $(whoami) /home/comby

RUN eval $(opam env) && opam install . --deps-only -y
# Next command must be a single run command for $(opam env) to take effect.
RUN eval $(opam env) && make && make test && make clean && make release

# The binary is now available in /home/comby/_build/default/src/main.exe
16 changes: 10 additions & 6 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ cd ../..

comby '"0.x.0"' "\"$VERSION\"" .ml -d src -i

# Build ubuntu docker binary release and copy binary
docker build --tag comby-ubuntu-build . -f dockerfiles/ubuntu/binary-release/Dockerfile
docker run --rm --entrypoint cat comby-ubuntu-build:latest /home/comby/_build/default/src/main.exe > scripts/$VERSION/comby-$VERSION-x86_64-linux
cd scripts/$VERSION && tar czvf comby-$VERSION-x86_64-linux.tar.gz comby-$VERSION-x86_64-linux && cd ../..

# Build mac binary
make clean
make release
make test
Expand All @@ -34,19 +40,17 @@ OS=$(uname -s || echo dunno)
if [ "$OS" = "Darwin" ]; then
cp _build/default/src/main.exe scripts/$VERSION/comby-$VERSION-x86_64-macos
cd scripts/$VERSION && tar czvf comby-$VERSION-x86_64-macos.tar.gz comby-$VERSION-x86_64-macos && cd ../..
else
cp _build/default/src/main.exe scripts/$VERSION/comby-$VERSION-x86_64-linux
cd scripts/$VERSION && tar czvf comby-$VERSION-x86_64-linux.tar.gz comby-$VERSION-x86_64-linux && cd ../..
fi

cp scripts/check-and-install.sh scripts/$VERSION/0/index.html
cp scripts/install-with-licenses.sh scripts/$VERSION/get/index.html
comby '"0.x.0"' "$VERSION" .html -i -d scripts/$VERSION

# docker images
# Alpine docker image
cd scripts
./build-docker-binary-releases.sh
docker tag comby-alpine-binary-release:latest comby/comby:$VERSION
echo "test: 'docker run -it comby/comby:$VERSION' -version"
echo "push: 'docker push comby/comby:$VERSION"
echo "test: 'docker run -it comby/comby:$VERSION -version'"
echo "push: 'docker push comby/comby:$VERSION'"
echo "tag latest: 'docker tag comby/comby:$VERSION comby/comby:latest"
echo "push: 'docker push comby/comby:latest"

0 comments on commit 030470f

Please sign in to comment.