From 02fd708d6e9362723db99a1364ea3cc582a52bfb Mon Sep 17 00:00:00 2001 From: insomnius Date: Mon, 28 Dec 2020 00:15:31 +0700 Subject: [PATCH] Add docker repository for altair --- .github/workflows/release.yml | 23 +++++++++++++++++++++++ Dockerfile | 10 ++++++++++ Makefile | 11 +++++++++++ README.md | 6 ++++++ 4 files changed, 50 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..e8944fd7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Publish Docker image +on: + release: + types: [published] +jobs: + push_to_registry: + name: Push Docker image to Github Registry + runs-on: ubuntu-20.04 + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Login to github registry + run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin + + - name: Build binary + run: make build + + - name: Build docker image + run: make build_docker + + - name: Push docker image + run: make push_docker diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..03c4d8fe --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM alpine:3.6 + +COPY ./build/linux/altair /usr/local/bin/ +COPY ./migration/ /opt/altair/ + +RUN apk --update upgrade +RUN apk --no-cache add curl tzdata + +EXPOSE 2019 +ENTRYPOINT ["altair", "run"] diff --git a/Makefile b/Makefile index 5bfcf949..3c221168 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +export VERSION ?= $(shell git show -q --format=%h) +export IMAGE ?= codefluence/altair + test: go test -race -cover -coverprofile=cover.out $$(go list ./... | grep -Ev "altair$$|core|mock|interfaces|testhelper") @@ -19,3 +22,11 @@ build: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./build/linux/altair GOOS=windows GOARCH=386 CGO_ENABLED=0 go build -o ./build/windows/altair GOOS=darwin GOARCH=386 CGO_ENABLED=0 go build -o ./build/darwin/altair + +build_docker: + sudo docker build -t $(IMAGE):$(VERSION) -f ./Dockerfile . + sudo docker build -t $(IMAGE):latest -f ./Dockerfile . + +push_docker: + sudo docker push $(IMAGE):$(VERSION) + sudo docker push $(IMAGE):latest diff --git a/README.md b/README.md index 0eb4f64d..5c4acc99 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,12 @@ This software is still in *alpha version*, which may contain several hidden bugs [Plugin API Documentation in Postman](https://documenter.getpostman.com/view/3666028/SzmcZJ79?version=latest#b870ae5a-b305-4016-8155-4899af1f26b1) +## Docker + +[[Here](https://hub.docker.com/r/codefluence/altair)] + +> TBD + ## How to Use > TBD