Skip to content

Commit

Permalink
Merge pull request #3 from graillus/chore/ci-automated-builds
Browse files Browse the repository at this point in the history
chore(ci): add automated docker builds
  • Loading branch information
graillus authored Oct 29, 2021
2 parents 418d077 + f8c6f9a commit 4349ee7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build

on:
push:
branches:
- "main"
tags:
- "*.*.*"
pull_request:
branches:
- 'main'
workflow_dispatch:

jobs:
build:
name: Build and Push docker image
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
graillus/translations-refresher
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to registry
uses: docker/login-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=graillus/translations-refresher:latest
cache-to: type=inline
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:alpine as builder

WORKDIR /go/src/github.com/ETSGlobal/translations-refresher
WORKDIR /go/src/github.com/graillus/translations-refresher

COPY go.mod .
COPY go.sum .
Expand All @@ -16,6 +16,6 @@ FROM alpine:latest

RUN apk --no-cache add ca-certificates

COPY --from=builder /go/src/github.com/ETSGlobal/translations-refresher/bin/refresher /usr/local/bin
COPY --from=builder /go/src/github.com/graillus/translations-refresher/bin/refresher /usr/local/bin

ENTRYPOINT ["refresher"]
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func main() {
}

app := newApp(config)
err = app.Init()
err := app.Init()
if err != nil {
panic(err.Error())
}
Expand Down

0 comments on commit 4349ee7

Please sign in to comment.