-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
109 changed files
with
12,377 additions
and
2,912 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,73 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ "dev" ] | ||
pull_request: | ||
branches: [ "dev" ] | ||
|
||
jobs: | ||
|
||
linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | ||
sudo apt-get install libwebp-dev | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
cache: false | ||
- name: Set environment variables | ||
run: | | ||
echo "GOROOT=$(go env GOROOT)" >> $GITHUB_ENV | ||
echo "GOBIN=$(go env GOBIN)" >> $GITHUB_ENV | ||
- name: Install golangci-lint | ||
run: | | ||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
- name: golangci-lint | ||
run: golangci-lint run --new-from-rev origin/dev | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.22' | ||
- name: Build | ||
run: go build -v ./... | ||
- name: Test | ||
run: go test -v ./... | ||
|
||
build: | ||
needs: [tests, linter] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up SSH | ||
uses: webfactory/ssh-agent@v0.5.3 | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
- name: Fetch .env file from server | ||
run: | | ||
ssh -o StrictHostKeyChecking=no ubuntu@185.241.194.197 ' | ||
# Read the contents of the .env file and output it | ||
cat ~/2024_2_BetterCallFirewall/.env | ||
' > .env | ||
- name: Login to DockerHub Registry | ||
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_LOGIN }} --password-stdin | ||
- name: Build Docker images | ||
run: | | ||
for service in auth authgrpc chat community file post postgrpc profile profilegrpc sticker; do | ||
docker build -t slashlight/${service}:${GITHUB_SHA::8} -t slashlight/${service}:latest -f Dockerfile${service} . | ||
docker push slashlight/${service}:${GITHUB_SHA::8} | ||
docker push slashlight/${service}:latest | ||
done | ||
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM golang:alpine AS build | ||
|
||
WORKDIR /stickers | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
|
||
RUN go mod download | ||
RUN go mod vendor | ||
|
||
COPY . . | ||
|
||
RUN go build cmd/stickers/main.go | ||
|
||
FROM alpine:latest | ||
|
||
WORKDIR /stickers | ||
|
||
EXPOSE 8088 | ||
|
||
COPY .env . | ||
|
||
COPY --from=build /stickers/main /stickers/main | ||
|
||
CMD ["./main"] |
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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"log" | ||
|
||
"github.com/2024_2_BetterCallFirewall/internal/app/stickers" | ||
"github.com/2024_2_BetterCallFirewall/internal/config" | ||
) | ||
|
||
func main() { | ||
confPath := flag.String("c", ".env", "path to config file") | ||
flag.Parse() | ||
|
||
cfg, err := config.GetConfig(*confPath) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
server, err := stickers.GetHTTPServer(cfg) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
log.Printf("Starting server on port %s", cfg.STICKER.Port) | ||
if err := server.ListenAndServe(); err != nil { | ||
panic(err) | ||
} | ||
} |
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.