Skip to content

Commit

Permalink
Merge pull request #12 from beeceej/release-via-docker
Browse files Browse the repository at this point in the history
Release: Publish the release via Dockerhub
  • Loading branch information
beeceej authored Oct 2, 2020
2 parents 165e378 + 9f832ef commit d316409
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: LGTM
uses: beeceej/[email protected].4
uses: beeceej/[email protected].6
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
FROM debian:buster-slim
RUN apt-get update -y && apt-get install netbase -y
ADD . .
ENTRYPOINT ./bin/entrypoint
FROM beeceej/lgtm:v0.0.5
ENTRYPOINT [ "bin/lgtm" ]
9 changes: 6 additions & 3 deletions Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ RUN opam install -y dune \
atdgen
ADD . .
RUN sudo chown -R opam:nogroup .
RUN ./bin/build
RUN mkdir release
RUN mv _build/default/src/main.exe release/lgtm
RUN bin/build

FROM debian:buster-slim
RUN apt-get update -y && apt-get install -y \
netbase -y
COPY --from=build /home/opam/opam-repository/lgtm/_build/default/src/main.exe bin/lgtm
31 changes: 20 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
VERSION := "v0.0.4"
RELEASE_IMAGE := beeceej/lgtm:release
USER := beeceej
IMAGE := lgtm
VERSION := v0.0.6
REPOSITORY:= $(USER)/$(IMAGE):$(VERSION)

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
build:
docker build -t $(REPOSITORY) -f Dockerfile.release .

tag:
docker tag $(REPOSITORY) $(REPOSITORY)

push:
docker push $(REPOSITORY)

docker-release:
docker build -t $(RELEASE_IMAGE) -f Dockerfile.release .
Dockerfile:
bin/generate_dockerfile $(VERSION)

clean:
rm -rf release
rm Dockerfile

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

.PHONY: clean docker-release
release: clean build push Dockerfile git-release
3 changes: 0 additions & 3 deletions bin/entrypoint

This file was deleted.

3 changes: 0 additions & 3 deletions bin/entrypoint~

This file was deleted.

9 changes: 9 additions & 0 deletions bin/generate_dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/sh

readonly dockerfile=$(cat <<EOF
FROM beeceej/lgtm:VERSION
ENTRYPOINT [ "bin/lgtm" ]
EOF
)
readonly version="$1"
echo "${dockerfile/VERSION/$version}" > Dockerfile
Binary file removed release/lgtm
Binary file not shown.

0 comments on commit d316409

Please sign in to comment.