Merge pull request #136 from creekorful/add-back-goreleaser

Add back goreleaser
pull/138/head
Aloïs Micard 3 years ago committed by GitHub
commit efc1ec2600
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,26 @@
name: Continuous Delivery
on:
push:
tags:
- '*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@ -1,4 +1,4 @@
name: CI
name: Continuous Integration
on:
push:

3
.gitignore vendored

@ -1,2 +1,3 @@
.idea/
**/**_mock.go
**/**_mock.go
dist/

@ -0,0 +1,96 @@
before:
hooks:
- go mod download
builds:
- id: bs-blacklister
main: ./cmd/bs-blacklister/bs-blacklister.go
binary: bs-blacklister
goos:
- linux
goarch:
- amd64
- id: bs-configapi
main: ./cmd/bs-configapi/bs-configapi.go
binary: bs-configapi
goos:
- linux
goarch:
- amd64
- id: bs-crawler
main: ./cmd/bs-crawler/bs-crawler.go
binary: bs-crawler
goos:
- linux
goarch:
- amd64
- id: bs-indexer
main: ./cmd/bs-indexer/bs-indexer.go
binary: bs-indexer
goos:
- linux
goarch:
- amd64
- id: bs-scheduler
main: ./cmd/bs-scheduler/bs-scheduler.go
binary: bs-scheduler
goos:
- linux
goarch:
- amd64
dockers:
- goos: linux
goarch: amd64
binaries:
- bs-blacklister
image_templates:
- "creekorful/bs-blacklister:latest"
- "creekorful/bs-blacklister:{{ replace .Tag \"v\" \"\" }}"
- "creekorful/bs-blacklister:{{ .Major }}"
skip_push: false
dockerfile: build/docker/Dockerfile.blacklister
- goos: linux
goarch: amd64
binaries:
- bs-configapi
image_templates:
- "creekorful/bs-configapi:latest"
- "creekorful/bs-configapi:{{ replace .Tag \"v\" \"\" }}"
- "creekorful/bs-configapi:{{ .Major }}"
skip_push: false
dockerfile: build/docker/Dockerfile.configapi
- goos: linux
goarch: amd64
binaries:
- bs-crawler
image_templates:
- "creekorful/bs-crawler:latest"
- "creekorful/bs-crawler:{{ replace .Tag \"v\" \"\" }}"
- "creekorful/bs-crawler:{{ .Major }}"
skip_push: false
dockerfile: build/docker/Dockerfile.crawler
- goos: linux
goarch: amd64
binaries:
- bs-indexer
image_templates:
- "creekorful/bs-indexer:latest"
- "creekorful/bs-indexer:{{ replace .Tag \"v\" \"\" }}"
- "creekorful/bs-indexer:{{ .Major }}"
skip_push: false
dockerfile: build/docker/Dockerfile.indexer
- goos: linux
goarch: amd64
binaries:
- bs-scheduler
image_templates:
- "creekorful/bs-scheduler:latest"
- "creekorful/bs-scheduler:{{ replace .Tag \"v\" \"\" }}"
- "creekorful/bs-scheduler:{{ .Major }}"
skip_push: false
dockerfile: build/docker/Dockerfile.scheduler
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-{{ .ShortCommit }}"
release:
prerelease: true

@ -54,10 +54,10 @@ If you've made a change to one of the crawler component and wish to use the upda
just need to issue the following command:
```sh
$ ./script/build.sh
$ goreleaser --snapshot --skip-publish --rm-dist
```
this will rebuild all crawler images using local changes. After that just run start.sh again to have the updated version
this will rebuild all images using local changes. After that just run start.sh again to have the updated version
running.
# Architecture

@ -1,24 +1,5 @@
# build image
FROM golang:1.15.0-alpine as builder
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /app
# Copy and download dependencies to cache them and faster build time
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Test then build app
RUN go build -v github.com/creekorful/bathyscaphe/cmd/bs-blacklister
# runtime image
FROM alpine:latest
COPY --from=builder /app/bs-blacklister /app/
WORKDIR /app/
ADD bs-blacklister /usr/bin/bs-blacklister
ENTRYPOINT ["./bs-blacklister"]
ENTRYPOINT ["/usr/bin/bs-blacklister"]

@ -1,24 +1,5 @@
# build image
FROM golang:1.15.0-alpine as builder
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /app
# Copy and download dependencies to cache them and faster build time
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Test then build app
RUN go build -v github.com/creekorful/bathyscaphe/cmd/bs-configapi
# runtime image
FROM alpine:latest
COPY --from=builder /app/bs-configapi /app/
WORKDIR /app/
ADD bs-configapi /usr/bin/bs-configapi
ENTRYPOINT ["./bs-configapi"]
ENTRYPOINT ["/usr/bin/bs-configapi"]

@ -1,24 +1,5 @@
# build image
FROM golang:1.15.0-alpine as builder
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /app
# Copy and download dependencies to cache them and faster build time
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Test then build app
RUN go build -v github.com/creekorful/bathyscaphe/cmd/bs-crawler
# runtime image
FROM alpine:latest
COPY --from=builder /app/bs-crawler /app/
WORKDIR /app/
ADD bs-crawler /usr/bin/bs-crawler
ENTRYPOINT ["./bs-crawler"]
ENTRYPOINT ["/usr/bin/bs-crawler"]

@ -1,24 +1,5 @@
# build image
FROM golang:1.15.0-alpine as builder
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /app
# Copy and download dependencies to cache them and faster build time
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Test then build app
RUN go build -v github.com/creekorful/bathyscaphe/cmd/bs-indexer
# runtime image
FROM alpine:latest
COPY --from=builder /app/bs-indexer /app/
WORKDIR /app/
ADD bs-indexer /usr/bin/bs-indexer
ENTRYPOINT ["./bs-indexer"]
ENTRYPOINT ["/usr/bin/bs-indexer"]

@ -1,24 +1,5 @@
# build image
FROM golang:1.15.0-alpine as builder
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /app
# Copy and download dependencies to cache them and faster build time
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Test then build app
RUN go build -v github.com/creekorful/bathyscaphe/cmd/bs-scheduler
# runtime image
FROM alpine:latest
COPY --from=builder /app/bs-scheduler /app/
WORKDIR /app/
ADD bs-scheduler /usr/bin/bs-scheduler
ENTRYPOINT ["./bs-scheduler"]
ENTRYPOINT ["/usr/bin/bs-scheduler"]

@ -1,13 +0,0 @@
#!/bin/bash
# set image tag if provided
tag="latest"
if [ "$1" ]; then
tag="$1"
fi
# build docker images
for path in build/docker/Dockerfile.*; do
name=$(echo "$path" | cut -d'.' -f2)
docker build . -f "$path" -t "creekorful/bs-$name:$tag"
done

@ -1,13 +0,0 @@
#!/bin/bash
# set image tag if provided
tag="latest"
if [ "$1" ]; then
tag="$1"
fi
# push docker images
for path in build/docker/Dockerfile.*; do
name=$(echo "$path" | cut -d'.' -f2)
docker push "creekorful/$name:$tag"
done

@ -1,33 +0,0 @@
#!/bin/bash
# make sure we have passed a tag as version
if [ "$1" ]; then
tag="$1"
else
echo "correct usage ./release.sh <tag>"
exit 1
fi
# create signed tag
git tag -s "v$tag" -m "Release $tag"
# build the docker images
./scripts/build.sh "$tag" # create version tag
./scripts/build.sh # create latest tag
echo ""
echo ""
echo "Release $tag is ready!"
echo "Please validate the changes, and once everything is confirmed, run the following:"
echo ""
echo "Update the git repository:"
echo ""
echo "$ git push && git push --tags"
echo ""
echo "Update the docker images:"
echo ""
echo "$ ./scripts/push.sh $tag"
echo "$ ./scripts/push.sh"
echo ""
echo ""
echo "Happy hacking ;D"
Loading…
Cancel
Save