2 Commits

Author SHA1 Message Date
Alex Shevchuk
e3262d588c 72
All checks were successful
Go Linter / Tag Commit (push) Successful in 14s
Deploy Production / Deploy to Staging (push) Has been skipped
Go Linter / Run golangci-lint (api_gateway) (push) Successful in 3m47s
Go Linter / Build golang services (api_gateway) (push) Successful in 4m15s
Go Linter / Push Docker Images (api_gateway) (push) Successful in 5m4s
2025-09-17 15:24:08 +03:00
Alex Shevchuk
33229f1eb7 71
Some checks failed
Go Linter / Tag Commit (push) Successful in 13s
Go Linter / Build golang services (api_gateway) (push) Successful in 3m2s
Deploy Production / Deploy to Staging (push) Has been skipped
Go Linter / Run golangci-lint (api_gateway) (push) Successful in 3m52s
Go Linter / Push Docker Images (api_gateway) (push) Failing after 1m45s
2025-09-17 15:11:39 +03:00
2 changed files with 10 additions and 6 deletions

View File

@@ -11,6 +11,8 @@ RUN go mod download -x
COPY . .
RUN go mod tidy && go mod download -x
RUN SWAGGER_HOST=${SWAGGER_HOST} make docs
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="${BUILD_LDFLAGS}" -trimpath -o main ./cmd/main.go

View File

@@ -10,6 +10,11 @@ ENV := "local"
UNAME_S := $(shell uname -s)
CONFIG_PATH := .build/config/
SWAGGER_DOCS_PATH := internal/http/swagger/docs
ifeq ($(UNAME_S),Darwin)
SED_INPLACE := -i ''
else
SED_INPLACE := -i
endif
ifeq ($(OS),Windows_NT)
CONFIG_PATH := $(subst /,\,$(CONFIG_PATH))
@@ -60,15 +65,12 @@ docs: $(BIN_DIR)/swag
@mkdir -p $(SWAGGER_DOCS_PATH)
@TEMP_MAIN="cmd/main_temp.go" && \
cp cmd/main.go $$TEMP_MAIN && \
if [[ "$$OSTYPE" == "darwin"* ]]; then \
sed -i '' "s/localhost:8000/$(HOST)/g" $$TEMP_MAIN; \
else \
sed -i "s/localhost:8000/$(HOST)/g" $$TEMP_MAIN; \
fi && \
ESC_HOST=$$(printf '%s\n' "$(HOST)" | sed -e 's/[\\\/&]/\\\\&/g') && \
sed $(SED_INPLACE) "s|localhost:8000|$${ESC_HOST}|g" $$TEMP_MAIN && \
$(BIN_DIR)/swag init -g $$TEMP_MAIN -o $(SWAGGER_DOCS_PATH) --parseDependency --parseInternal && \
rm -f $$TEMP_MAIN && \
echo "Swagger документация успешно сгенерирована с host: $(HOST)" && \
echo "Документация доступна по адресу: http://$(HOST)/swagger/index.html"
echo "Документация доступна по адресу: $(HOST)/swagger/index.html"
## -- Run --
## To change env use: make run CONFIG_PATH={config file dir path} ENV={env}