Skip to content

Commit

Permalink
LGTM: include binary in repo
Browse files Browse the repository at this point in the history
- Makefile which uses docker to create and build the binary
- github actions Dockerfile just copies the binary in and runs the durnd thing
  • Loading branch information
beeceej committed May 10, 2020
1 parent 4c75c12 commit caff0d6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 21 deletions.
21 changes: 1 addition & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
FROM ocaml/opam2 as build
RUN sudo apt-get update -y && \
sudo apt-get install \
pkg-config \
libgmp-dev \
m4 \
netbase -y
RUN opam install -y dune \
tls \
cohttp \
cohttp-lwt-unix \
yojson \
atdgen
WORKDIR lgtm
ADD . .
RUN sudo chown -R opam:nogroup .
RUN ./bin/build

FROM debian:buster-slim
COPY --from=build /home/opam/opam-repository/lgtm/_build/default/src/main.exe lgtm
RUN apt-get update -y && apt-get install netbase -y
ADD bin bin
ADD . .
ENTRYPOINT ./bin/entrypoint
17 changes: 17 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ocaml/opam2 as build
WORKDIR lgtm
RUN sudo apt-get update -y && sudo apt-get install -y \
pkg-config \
libgmp-dev \
m4
RUN opam install -y dune \
tls \
cohttp \
cohttp-lwt-unix \
yojson \
atdgen
ADD . .
RUN sudo chown -R opam:nogroup .
RUN ./bin/build
RUN mkdir release
RUN mv _build/default/src/main.exe release/lgtm
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
VERSION := "v0.0.3"
RELEASE_IMAGE := beeceej/lgtm:release

release: clean lgtm
git tag -a "$(VERSION)" -m "release $(VERSION)"
git push --tags

lgtm: docker-release
docker run -it --rm -v "$${PWD}/release:/home/opam/opam-repository/lgtm/tmp" beeceej/lgtm:release mv release/lgtm tmp/lgtm
docker-release:
docker build -t $(RELEASE_IMAGE) -f Dockerfile.release .

clean:
rm -rf release

.PHONY: clean docker-release
2 changes: 1 addition & 1 deletion bin/entrypoint
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /bin/sh

/lgtm
./release/lgtm
Binary file added release/lgtm
Binary file not shown.

0 comments on commit caff0d6

Please sign in to comment.