-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from mrtazz/add-docker-image
add docker build
- Loading branch information
Showing
4 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: CI | ||
on: push | ||
jobs: | ||
|
||
build: | ||
name: build and test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Check out code | ||
uses: actions/checkout@master | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: install dependencies | ||
run: | | ||
sudo wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb | ||
sudo dpkg -i pandoc-2.7.3-1-amd64.deb | ||
- name: build and run unit tests | ||
run: make clean all test | ||
|
||
- name: Run checkmake on Makefile | ||
run: ./checkmake Makefile | ||
|
||
docker: | ||
needs: build | ||
name: docker image build and release | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag mrtazz/checkmake:${GITHUB_SHA} --tag mrtazz/checkmake:latest | ||
|
||
- name: push the docker image to docker hub | ||
if: github.ref == 'refs/heads/master' | ||
run: | | ||
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login hub.docker.com -u mrtazz --password-stdin | ||
docker push mrtazz/checkmake:${GITHUB_SHA} | ||
docker push mrtazz/checkmake:latest | ||
docker logout hub.docker.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM golang:1.13 as builder | ||
|
||
COPY . /checkmake | ||
|
||
RUN cd /checkmake && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 make binaries | ||
|
||
FROM alpine:3.9 | ||
|
||
USER nobody | ||
|
||
COPY --from=builder /checkmake / | ||
ENTRYPOINT ["./checkmake", "/Makefile"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters