Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dockerfile for debian, alpine #570

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
43a10ec
Add support for validating MS Teams outgoing webhooks
emilhf Feb 21, 2021
060f5b6
fix 'err:parameter node not found'when a dotted reference is not the …
Apr 5, 2021
afd20c5
add ability to stream command output as a response
lostsnow Aug 4, 2021
45d0e83
Update README.md
bakwc Dec 15, 2021
9da8289
feat: add dockerfile for debian, alpine
soulteary Jan 1, 2022
1cdbd7e
add: tests for internal/hooks/requests.go
atlekbai Oct 3, 2022
14ec47b
add: additional test for invalid json payload
atlekbai Oct 3, 2022
e439cac
Fix CONTRIBUTING.md links to issues
nopcoder Oct 10, 2022
d7367bc
Fix error on unrecognized configuration keys
nopcoder Oct 11, 2022
32a7819
Merge branch 'adnanh:master' into master
soulteary Jan 9, 2023
d7226e8
chore: update deps, go 1.19
soulteary Jan 9, 2023
f93670d
chore: update docker
soulteary Jan 9, 2023
90fdae3
chore: go mod vendor
soulteary Jan 9, 2023
5730b0e
chore: rm legacy vendor
soulteary Jan 9, 2023
5f59f90
fix: Fix 1.19 incompatibilities
soulteary Jan 9, 2023
b05d94d
chore: update ignore list for coverage.out
soulteary Jan 9, 2023
f90fc7c
Merge pull request #1 from nopcoder/fix/load-unrecognized-keys
soulteary Jan 9, 2023
3f83f1f
Merge pull request #2 from atlekbai/test/hook-request
soulteary Jan 9, 2023
603f5b3
Merge pull request #3 from bakwc/bakwc-removed-snap
soulteary Jan 9, 2023
741423f
Merge pull request #4 from nopcoder/docs/contributing
soulteary Jan 9, 2023
46f93d7
Merge pull request #5 from lostsnow/feature/stream-output-as-response
soulteary Jan 9, 2023
5cb0bc7
Merge pull request #6 from AdrieVanDijk/dotted-reference-fix
soulteary Jan 9, 2023
750af32
Merge pull request #7 from emilhf/add-msteams-support
soulteary Jan 9, 2023
9900481
refactor: fmt, update dockerfiles
soulteary Jan 9, 2023
5a3828e
docs: update docs, license
soulteary Jan 9, 2023
3285d30
fix: revert #1
soulteary Jan 9, 2023
70e99fb
chore: mv example to dir
soulteary Jan 9, 2023
8b887fc
chore: mv dockerfile to dir
soulteary Jan 9, 2023
2b2997c
refactor: add platform
soulteary Jan 9, 2023
1890fe8
refactor: add https
soulteary Jan 9, 2023
267b187
chore: update build script
soulteary Jan 9, 2023
6c83167
chore: add scan.yml
soulteary Jan 9, 2023
9e754e8
chore: add goreleaser
soulteary Jan 9, 2023
ffe22db
chore: add docker for goreleaser
soulteary Jan 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Dockerfile
Dockerfile.*
coverage.out
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

77 changes: 58 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,62 @@
name: build
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
go-version: [1.14.x, 1.15.x]
os: [ubuntu-latest, macos-latest, windows-latest]
name: Release

runs-on: ${{ matrix.os }}
on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*'
env:
GO_VERSION: 1.19

jobs:
build:
runs-on: ubuntu-latest
env:
GO111MODULE: on
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
-
name: Checkout
uses: actions/checkout@v3
with:
go-version: ${{ matrix.go-version }}
id: go

- name: Build
run: go build -v

- name: Test
run: go test -v ./...
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Tests
run: |
go mod tidy
go test -v ./...
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Security Scan"

# Run workflow each time code is pushed to your repository and on a schedule.
# The scheduled workflow runs every at 00:00 on Sunday UTC time.
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'internal/**'
- '*.go'
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * 0'

jobs:
scan:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Security Scan
uses: securego/gosec@master
with:
# we let the report trigger content trigger a failure using the GitHub Security features.
args: '-no-fail -fmt sarif -out results.sarif ./...'
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ coverage
webhook
/test/hookecho
build
coverage.out
117 changes: 117 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
project_name: webhook

builds:
- <<: &build_defaults
env:
- CGO_ENABLED=0
ldflags:
- -w -s -X "github.com/soulteary/webhook/internal/version/version.Version={{ .Tag }}"
id: macos
goos: [ darwin ]
goarch: [ amd64, arm64 ]

- <<: *build_defaults
id: linux
goos: [linux]
goarch: ["386", arm, amd64, arm64]
goarm:
- "7"
- "6"

dockers:

- image_templates:
- "soulteary/webhook:linux-amd64-{{ .Tag }}"
- "soulteary/webhook:linux-amd64"
dockerfile: docker/Dockerfile.gorelease
use: buildx
goarch: amd64
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.description={{ .ProjectName }}"
- "--label=org.opencontainers.image.url=https://github.com/soulteary/webhook"
- "--label=org.opencontainers.image.source=https://github.com/soulteary/webhook"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.licenses=Apache-v2"

- image_templates:
- "soulteary/webhook:linux-arm64-{{ .Tag }}"
- "soulteary/webhook:linux-arm64"
dockerfile: docker/Dockerfile.gorelease
use: buildx
goos: linux
goarch: arm64
goarm: ''
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.description={{ .ProjectName }}"
- "--label=org.opencontainers.image.url=https://github.com/soulteary/webhook"
- "--label=org.opencontainers.image.source=https://github.com/soulteary/webhook"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.licenses=Apache-v2"

- image_templates:
- "soulteary/webhook:linux-armv7-{{ .Tag }}"
- "soulteary/webhook:linux-armv7"
dockerfile: docker/Dockerfile.gorelease
use: buildx
goos: linux
goarch: arm
goarm: "7"
build_flag_templates:
- "--pull"
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.description={{ .ProjectName }}"
- "--label=org.opencontainers.image.url=https://github.com/soulteary/webhook"
- "--label=org.opencontainers.image.source=https://github.com/soulteary/webhook"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.licenses=Apache-v2"

- image_templates:
- "soulteary/webhook:linux-armv6-{{ .Tag }}"
- "soulteary/webhook:linux-armv6"
dockerfile: docker/Dockerfile.gorelease
use: buildx
goos: linux
goarch: arm
goarm: "6"
build_flag_templates:
- "--pull"
- "--platform=linux/arm/v6"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.description={{ .ProjectName }}"
- "--label=org.opencontainers.image.url=https://github.com/soulteary/webhook"
- "--label=org.opencontainers.image.source=https://github.com/soulteary/webhook"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.licenses=Apache-v2"


docker_manifests:
- name_template: "soulteary/webhook:{{ .Tag }}"
image_templates:
- "soulteary/webhook:linux-amd64-{{ .Tag }}"
- "soulteary/webhook:linux-arm64-{{ .Tag }}"
- "soulteary/webhook:linux-armv7-{{ .Tag }}"
- "soulteary/webhook:linux-armv6-{{ .Tag }}"
skip_push: "false"

- name_template: "soulteary/webhook:latest"
image_templates:
- "soulteary/webhook:linux-amd64-{{ .Tag }}"
- "soulteary/webhook:linux-arm64-{{ .Tag }}"
- "soulteary/webhook:linux-armv7-{{ .Tag }}"
- "soulteary/webhook:linux-armv6-{{ .Tag }}"
skip_push: "false"
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We welcome any type of contribution, not only code. You can help with
- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
- **Marketing**: writing blog posts, howto's, printing stickers, ...
- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
- **Code**: take a look at the [open issues](https://github.com/adnanh/webhook/issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/webhook).

## Your First Contribution
Expand All @@ -31,7 +31,7 @@ Anyone can file an expense. If the expense makes sense for the development of th

## Questions

If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!).
If you have any questions, create an [issue](https://github.com/adnanh/webhook/issues/new) (protip: do a quick search first to see if someone else didn't ask the same question before!).
You can also reach us at hello@webhook.opencollective.com.

## Credits
Expand Down Expand Up @@ -64,4 +64,4 @@ Thank you to all our sponsors! (please ask your company to also support this ope
<a href="https://opencollective.com/webhook/sponsor/8/website" target="_blank"><img src="https://opencollective.com/webhook/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/webhook/sponsor/9/website" target="_blank"><img src="https://opencollective.com/webhook/sponsor/9/avatar.svg"></a>

<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->
<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The MIT License (MIT)

Copyright (c) 2023 soulteary <soulteary@gmail.com>
Copyright (c) 2015 Adnan Hajdarevic <adnanh@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
OS = darwin freebsd linux openbsd
ARCHS = 386 arm amd64 arm64
DOCKER_REPO_NAME=adnanh/webhook

.DEFAULT_GOAL := help

Expand Down Expand Up @@ -33,6 +34,10 @@ release-windows: clean deps ## Generate release for windows
tar cz -C build -f build/webhook-windows-$$arch.tar.gz webhook-windows-$$arch; \
done

release-docker:
docker build -t "${DOCKER_REPO_NAME}" -f Dockerfile .
docker build -t "${DOCKER_REPO_NAME}:alpine" -f Dockerfile.alpine .

test: deps ## Execute tests
go test ./...

Expand Down