Skip to content

Commit

Permalink
Add GoReleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
Ordspilleren committed Jun 10, 2021
1 parent 9f4261c commit 7722577
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 35 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
-
name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Docker Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 0 additions & 24 deletions .github/workflows/ci.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
project_name: changemonitor
builds:
- env: [CGO_ENABLED=0]
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
dockers:
- goos: linux
goarch: amd64
image_templates:
- "ordspilleren/{{.ProjectName}}:latest"
- "ordspilleren/{{.ProjectName}}:{{ .Tag }}"
dockerfile: Dockerfile
13 changes: 2 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
# Build image
FROM golang:alpine AS build
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go build -o ./out/app .

# Runtime image
FROM alpine
COPY --from=build /app/out/app /usr/local/bin/changemonitor
COPY changemonitor /usr/bin/changemonitor
RUN apk add --no-cache tzdata
ENV CONFIG_FILE=/config/config.json
ENV STORAGE_DIRECTORY=/data
ENV CHROME_WS=ws://127.0.0.1:9222
ENV ENABLE_WEBUI=false
ENTRYPOINT ["/usr/local/bin/changemonitor"]
ENTRYPOINT ["/usr/bin/changemonitor"]

0 comments on commit 7722577

Please sign in to comment.