Skip to content

Commit 7722577

Browse files
committed
Add GoReleaser
1 parent 9f4261c commit 7722577

File tree

4 files changed

+62
-35
lines changed

4 files changed

+62
-35
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: build
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
-
13+
name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
-
18+
name: Set up Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: 1.16
22+
-
23+
name: Cache Go modules
24+
uses: actions/cache@v2
25+
with:
26+
path: ~/go/pkg/mod
27+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-
30+
-
31+
name: Docker Login
32+
uses: docker/login-action@v1
33+
with:
34+
username: ${{ secrets.DOCKERHUB_USERNAME }}
35+
password: ${{ secrets.DOCKERHUB_TOKEN }}
36+
-
37+
name: Run GoReleaser
38+
uses: goreleaser/goreleaser-action@v2
39+
with:
40+
version: latest
41+
args: release --rm-dist
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.goreleaser.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
project_name: changemonitor
2+
builds:
3+
- env: [CGO_ENABLED=0]
4+
goos:
5+
- linux
6+
- windows
7+
- darwin
8+
goarch:
9+
- amd64
10+
- arm64
11+
dockers:
12+
- goos: linux
13+
goarch: amd64
14+
image_templates:
15+
- "ordspilleren/{{.ProjectName}}:latest"
16+
- "ordspilleren/{{.ProjectName}}:{{ .Tag }}"
17+
dockerfile: Dockerfile

Dockerfile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
# Build image
2-
FROM golang:alpine AS build
3-
WORKDIR /app
4-
COPY go.mod go.sum ./
5-
RUN go mod download
6-
COPY . ./
7-
RUN CGO_ENABLED=0 GOOS=linux go build -o ./out/app .
8-
9-
# Runtime image
101
FROM alpine
11-
COPY --from=build /app/out/app /usr/local/bin/changemonitor
2+
COPY changemonitor /usr/bin/changemonitor
123
RUN apk add --no-cache tzdata
134
ENV CONFIG_FILE=/config/config.json
145
ENV STORAGE_DIRECTORY=/data
156
ENV CHROME_WS=ws://127.0.0.1:9222
167
ENV ENABLE_WEBUI=false
17-
ENTRYPOINT ["/usr/local/bin/changemonitor"]
8+
ENTRYPOINT ["/usr/bin/changemonitor"]

0 commit comments

Comments
 (0)