Skip to content

Commit

Permalink
Add Build and GH Action
Browse files Browse the repository at this point in the history
  • Loading branch information
dbpolito committed Jul 6, 2020
1 parent 7b52348 commit b8faf64
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: docker

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@master

- uses: olegtarasov/get-tag@v1
id: tagName

- name: Build image
env:
TAGNAME: ${{ steps.tagName.outputs.tag }}
run: docker build --pull -t kooldev/kool:$TAGNAME .

- name: Test image
env:
TAGNAME: ${{ steps.tagName.outputs.tag }}
run: docker run kooldev/kool:$TAGNAME kool --version

- name: Push to hub
env:
TAGNAME: ${{ steps.tagName.outputs.tag }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker tag kooldev/kool:$TAGNAME kooldev/kool:1.0
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
docker push kooldev/kool:$TAGNAME
docker push kooldev/kool:1.0
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.vscode/
/fwd
/kool
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM docker/compose:alpine-1.26.2 AS docker-compose
FROM golang:alpine3.12 AS build

WORKDIR /app

COPY . /app

RUN go build -o kool

FROM alpine:3.12

COPY --from=docker-compose /usr/local/bin/docker /usr/local/bin/docker
COPY --from=docker-compose /usr/local/bin/docker-compose /usr/local/bin/docker-compose
COPY --from=build /app/kool /usr/local/bin/kool

CMD [ "kool" ]

0 comments on commit b8faf64

Please sign in to comment.