-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rewrite Dockerfile * Fix dev Dockerfile * Update dockerfiles and configuration accessor * Add more test suites * Add gatling tests * Enhance cache speed and tests * Test coverage over 60% * Improve cache speed and post results * Implement by regex configuration * Refactoring and performance update done * Update results * Upgrades * Introduce Ristretto cache module * Increase performance by 43 percent * Close unused channels * GH action setup on tag creation * Update docker-compose for prod * Generate artifacts * Update README * Update docker-compose files * Update configuration.sample * Add package builder/releaser
- Loading branch information
Showing
29 changed files
with
1,087 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Build container and publish to docker hub | ||
|
||
on: | ||
create: | ||
tags: ["v*"] | ||
|
||
jobs: | ||
generate-binary: | ||
name: Generate binary | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Get tag name | ||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/} | ||
- | ||
name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- | ||
name: Build & push Docker image containing only binary | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
file: ./Dockerfile-prod | ||
tags: | | ||
darkweak/souin:latest | ||
darkweak/souin:${{ env.RELEASE_VERSION }} | ||
generate-artifacts: | ||
name: Generate cross-platform builds | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.13 | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,43 @@ | ||
FROM golang:1.13-alpine | ||
FROM golang:1.13-alpine AS builder | ||
|
||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache bash git openssh gcc libc-dev | ||
ENV GOPATH /app | ||
ENV GOOS linux | ||
ENV GOARCH arm64 | ||
RUN go get -u \ | ||
golang.org/x/lint/golint \ | ||
github.com/allegro/bigcache \ | ||
github.com/dgraph-io/ristretto \ | ||
github.com/fsnotify/fsnotify \ | ||
github.com/go-redis/redis \ | ||
gopkg.in/yaml.v2 | ||
|
||
RUN mkdir -p /app/src/github.com/darkweak/cmd | ||
RUN mkdir -p /ssl | ||
RUN mkdir -p /app/src/github.com/darkweak/souin | ||
RUN mkdir -p /ssl | ||
ADD ./*.go /app/src/github.com/darkweak/souin/ | ||
ADD ./cache /app/src/github.com/darkweak/souin/cache | ||
ADD ./errors /app/src/github.com/darkweak/souin/errors | ||
ADD ./providers /app/src/github.com/darkweak/souin/providers | ||
ADD ./default/server.* /app/src/github.com/darkweak/souin/ | ||
ADD ./configuration/configuration.yml / | ||
ADD ./configuration/* /app/src/github.com/darkweak/souin/configuration/ | ||
ADD ./entrypoint.sh /app/src/github.com/darkweak/souin/entrypoint.sh | ||
|
||
WORKDIR /app/src/github.com/darkweak/souin | ||
ENV GOPATH /app | ||
ENV GOOS linux | ||
ENV GOARCH arm | ||
RUN go get -u \ | ||
golang.org/x/lint/golint \ | ||
github.com/allegro/bigcache \ | ||
github.com/fsnotify/fsnotify \ | ||
github.com/go-redis/redis \ | ||
gopkg.in/yaml.v2 | ||
RUN chmod 755 ./entrypoint.sh | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a \ | ||
-tags netgo -ldflags '-w -extldflags "-static"' -o /app/cmd/souin . | ||
|
||
EXPOSE 80 | ||
|
||
ENTRYPOINT ["./entrypoint.sh"] | ||
FROM alpine:latest AS souin | ||
|
||
COPY --from=builder /app/cmd/souin . | ||
COPY --from=builder /app/src/github.com/darkweak/souin/configuration . | ||
COPY --from=builder /ssl/ . | ||
COPY --from=builder /app/src/github.com/darkweak/souin/server.crt . | ||
COPY --from=builder /app/src/github.com/darkweak/souin/server.key . | ||
RUN chmod +x ./souin | ||
|
||
CMD ["./souin"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.