Skip to content

Commit

Permalink
chore: reduce binary size by removing swagger route
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcStdt committed Aug 19, 2024
1 parent 53791c3 commit 4c06fe6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ VERSION ?= "dev"
build: ## Build Daemon
CGO_ENABLED=0 go build -ldflags "-X github.com/highcard-dev/daemon/internal.Version=$(VERSION)" -o ./bin/druid

build-x86-docker:
docker build . -f build/Dockerfile.darwin -t golang-new-builder:latest
docker run -e GOOS=linux -e GOARCH=amd64 -it --rm -v ./:/app -w /app --entrypoint=/bin/bash golang-new-builder:latest -c 'CGO_ENABLED=1 go build -ldflags "-X github.com/highcard-dev/daemon/internal.Version=$(VERSION)" -o ./bin/x86/druid'

install: ## Install Daemon
cp ./bin/druid /usr/local/bin/druid

Expand Down
3 changes: 3 additions & 0 deletions build/Dockerfile.darwin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM docker.elastic.co/beats-dev/golang-crossbuild:1.22.5-main

RUN apt-get update && apt-get install -y libpcap-dev
3 changes: 1 addition & 2 deletions cmd/server/web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
jwtware "github.com/gofiber/jwt/v3"
"github.com/gofiber/swagger"
"github.com/highcard-dev/daemon/cmd/server/web/middlewares"
constants "github.com/highcard-dev/daemon/internal"
"github.com/highcard-dev/daemon/internal/core/ports"
Expand Down Expand Up @@ -162,7 +161,7 @@ func (s *Server) SetAPI(app *fiber.App) *fiber.App {
})
})

app.Get("/swagger/*", swagger.HandlerDefault) // default
//app.Get("/swagger/*", swagger.HandlerDefault) // default

//Catch-all 404 page
app.Use(func(ctx *fiber.Ctx) error {
Expand Down

0 comments on commit 4c06fe6

Please sign in to comment.