mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 15:22:47 +01:00
feat: docker healthcheck (#1106)
This commit is contained in:
@@ -13,7 +13,7 @@ builds:
|
|||||||
|
|
||||||
dockers:
|
dockers:
|
||||||
- ids: [ catalyst ]
|
- ids: [ catalyst ]
|
||||||
dockerfile: docker/goreleaser.Dockerfile
|
dockerfile: docker/Dockerfile
|
||||||
image_templates:
|
image_templates:
|
||||||
- "ghcr.io/securitybrewery/catalyst:main"
|
- "ghcr.io/securitybrewery/catalyst:main"
|
||||||
- "ghcr.io/securitybrewery/catalyst:latest"
|
- "ghcr.io/securitybrewery/catalyst:latest"
|
||||||
|
|||||||
16
Makefile
16
Makefile
@@ -39,6 +39,22 @@ build-ui:
|
|||||||
cd ui && bun install
|
cd ui && bun install
|
||||||
cd ui && bun build-only
|
cd ui && bun build-only
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build: build-ui
|
||||||
|
@echo "Building..."
|
||||||
|
go build -o catalyst .
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: build-linux
|
||||||
|
build-linux: build-ui
|
||||||
|
@echo "Building..."
|
||||||
|
GOOS=linux GOARCH=amd64 go build -o catalyst .
|
||||||
|
|
||||||
|
.PHONY: docker
|
||||||
|
docker: build-linux
|
||||||
|
@echo "Building Docker image..."
|
||||||
|
docker build -f docker/Dockerfile -t catalyst .
|
||||||
|
|
||||||
.PHONY: dev
|
.PHONY: dev
|
||||||
dev:
|
dev:
|
||||||
@echo "Running..."
|
@echo "Running..."
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ func addRoutes() func(*core.ServeEvent) error {
|
|||||||
return c.Redirect(http.StatusFound, "/ui/")
|
return c.Redirect(http.StatusFound, "/ui/")
|
||||||
})
|
})
|
||||||
e.Router.GET("/ui/*", staticFiles())
|
e.Router.GET("/ui/*", staticFiles())
|
||||||
|
e.Router.GET("/health", func(c echo.Context) error {
|
||||||
|
if _, err := Flags(e.App); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.String(http.StatusOK, "OK")
|
||||||
|
})
|
||||||
|
|
||||||
e.Router.GET("/api/config", func(c echo.Context) error {
|
e.Router.GET("/api/config", func(c echo.Context) error {
|
||||||
flags, err := Flags(e.App)
|
flags, err := Flags(e.App)
|
||||||
|
|||||||
@@ -1,24 +1,14 @@
|
|||||||
FROM oven/bun:debian
|
|
||||||
RUN apt-get update && apt-get install -y make
|
|
||||||
COPY .. /tmp/catalyst
|
|
||||||
|
|
||||||
WORKDIR /tmp/catalyst
|
|
||||||
|
|
||||||
RUN make build-ui
|
|
||||||
|
|
||||||
FROM golang:1.23
|
|
||||||
COPY --from=0 /tmp/catalyst /tmp/catalyst
|
|
||||||
|
|
||||||
WORKDIR /tmp/catalyst
|
|
||||||
|
|
||||||
RUN go build -o /usr/local/bin/catalyst
|
|
||||||
|
|
||||||
FROM ubuntu:24.04
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
COPY --from=1 /usr/local/bin/catalyst /usr/local/bin/catalyst
|
RUN apt-get update && apt-get install -y curl python3 python3-pip python3-venv
|
||||||
|
|
||||||
|
COPY catalyst /usr/local/bin/catalyst
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
VOLUME /usr/local/bin/catalyst_data
|
VOLUME /usr/local/bin/catalyst_data
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=5s --timeout=3s --retries=3 \
|
||||||
|
CMD curl -f http://localhost:8080/health || exit 1
|
||||||
|
|
||||||
CMD ["/usr/local/bin/catalyst", "serve", "--http", "0.0.0.0:8080"]
|
CMD ["/usr/local/bin/catalyst", "serve", "--http", "0.0.0.0:8080"]
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
FROM ubuntu:24.04
|
|
||||||
|
|
||||||
COPY catalyst /usr/local/bin/catalyst
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
VOLUME /usr/local/bin/catalyst_data
|
|
||||||
|
|
||||||
CMD ["/usr/local/bin/catalyst", "serve", "--http", "0.0.0.0:8080"]
|
|
||||||
Reference in New Issue
Block a user