Skip to content

Commit

Permalink
Add docker CI/CD in goreleaser
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Emmanuel Jacquier <[email protected]>
  • Loading branch information
pierre-emmanuelJ committed May 20, 2020
1 parent 70152f5 commit 9ac6041
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM alpine:3.11.6
COPY iptv-proxy /
ENTRYPOINT ["/iptv-proxy"]
3 changes: 3 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Docker login
run: echo ${{ secrets.GH_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
-
name: Set up Go
uses: actions/setup-go@v2
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Run golangci-lint
uses: actions-contrib/golangci-lint@v1
uses: golangci/golangci-lint-action@v1
with:
version: v1.27
- name: Run tests and attempt building
run: |
export PATH=$(go env GOPATH)/bin:$PATH
go test -mod vendor -v -race ./...
go build -mod vendor
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag iptv-proxy:ci-build
29 changes: 0 additions & 29 deletions .github/workflows/dockerimage.yml

This file was deleted.

23 changes: 21 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,34 @@ release:
github:
owner: pierre-emmanuelJ
name: iptv-proxy
draft: true
draft: false

nfpms:
-
vendor: Pierre-Emmanuel
vendor: Pierre-Emmanuel Jacquier
homepage: https://github.com/pierre-emmanuelJ/iptv-proxy
maintainer: Pierre-Emmanuel <[email protected]>
description: Reverse proxy on iptv m3u file
license: Apache 2.0
formats:
- deb
- rpm

dockers:
-
goos: linux
goarch: amd64
binaries:
- iptv-proxy
image_templates:
- "docker.pkg.github.com/pierre-emmanuelj/iptv-proxy/iptv-proxy:{{ .Tag }}"

skip_push: false

build_flag_templates:
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"

dockerfile: .Dockerfile.goreleaser
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ WORKDIR /go/src/github.com/pierre-emmanuelJ/iptv-proxy
COPY . .
RUN GO111MODULE=off CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o iptv-proxy .

FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /go/src/github.com/pierre-emmanuelJ/iptv-proxy/iptv-proxy .
CMD ["./iptv-proxy"]
FROM alpine:3.11.6
COPY --from=0 /go/src/github.com/pierre-emmanuelJ/iptv-proxy/iptv-proxy /
ENTRYPOINT ["/iptv-proxy"]

0 comments on commit 9ac6041

Please sign in to comment.