diff --git a/backend/Dockerfile b/backend/Dockerfile index 269e2b4..1b066d1 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -10,12 +10,20 @@ FROM debian:bookworm-slim AS runtime WORKDIR /app +RUN apt-get update && \ + apt-get install -y curl && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + ARG PORT=8080 RUN mkdir -p /app/csv COPY --from=build /app/ . +HEALTHCHECK --interval=60s --timeout=40s \ + CMD curl -f http://localhost:8080/ping || exit 1 + EXPOSE ${PORT} CMD ["/app/conf-backend", "server"] \ No newline at end of file diff --git a/backend/server.go b/backend/server.go index 90a46be..9d30d60 100644 --- a/backend/server.go +++ b/backend/server.go @@ -23,7 +23,7 @@ func NewServer(config *ServerConfig) *echo.Echo { // NOTE: Only need to handle CORS, everything else is being handled by the API gateway e.Use(middleware.CORSWithConfig(middleware.CORSConfig{ AllowOrigins: []string{"https://conf.teknologiumum.com"}, - AllowMethods: []string{"POST"}, + AllowMethods: []string{http.MethodPost}, AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept}, AllowCredentials: false, MaxAge: 3600, // 1 day @@ -31,6 +31,10 @@ func NewServer(config *ServerConfig) *echo.Echo { e.Use(middleware.RequestID()) + e.GET("/ping", func(c echo.Context) error { + return c.NoContent(http.StatusOK) + }) + e.POST("/users", func(c echo.Context) error { requestId := c.Request().Header.Get(echo.HeaderXRequestID) sentryHub := sentryecho.GetHubFromContext(c)