feat: optimize gotrue compile size
This commit is contained in:
parent
51fbca057e
commit
04b2d79025
|
|
@ -92,6 +92,5 @@ services:
|
||||||
# Prometheus Metrics
|
# Prometheus Metrics
|
||||||
- GOTRUE_METRICS_ENABLED=true
|
- GOTRUE_METRICS_ENABLED=true
|
||||||
- GOTRUE_METRICS_EXPORTER=prometheus
|
- GOTRUE_METRICS_EXPORTER=prometheus
|
||||||
- GOTRUE_EXTERNAL_SAML_ENABLED=true
|
|
||||||
ports:
|
ports:
|
||||||
- 9998:9999
|
- 9998:9999
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,6 @@ services:
|
||||||
# Prometheus Metrics
|
# Prometheus Metrics
|
||||||
- GOTRUE_METRICS_ENABLED=true
|
- GOTRUE_METRICS_ENABLED=true
|
||||||
- GOTRUE_METRICS_EXPORTER=prometheus
|
- GOTRUE_METRICS_EXPORTER=prometheus
|
||||||
- GOTRUE_EXTERNAL_SAML_ENABLED=true
|
|
||||||
ports:
|
ports:
|
||||||
- 9998:9999
|
- 9998:9999
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
FROM golang as base
|
FROM golang as base
|
||||||
WORKDIR /go/src/supabase
|
WORKDIR /go/src/supabase
|
||||||
RUN git clone https://github.com/supabase/gotrue.git
|
RUN git clone https://github.com/supabase/gotrue.git --depth 1 --branch v2.117.0
|
||||||
WORKDIR /go/src/supabase/gotrue
|
WORKDIR /go/src/supabase/gotrue
|
||||||
RUN git checkout e67a10c1 && \
|
COPY docker/gotrue.patch .
|
||||||
CGO_ENABLED=0 \
|
RUN git apply gotrue.patch
|
||||||
GOOS=linux \
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /gotrue .
|
||||||
GOARCH=amd64 \
|
|
||||||
go build -o /gotrue .
|
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
|
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
|
||||||
|
|
@ -15,5 +13,6 @@ COPY --from=base /etc/passwd /etc/passwd
|
||||||
COPY --from=base /etc/group /etc/group
|
COPY --from=base /etc/group /etc/group
|
||||||
|
|
||||||
COPY --from=base /gotrue .
|
COPY --from=base /gotrue .
|
||||||
|
COPY --from=base /go/src/supabase/gotrue/migrations ./migrations
|
||||||
|
|
||||||
CMD ["./gotrue"]
|
CMD ["./gotrue"]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
# This patch is done because there is no way to enable SSO/SAML at the moment
|
||||||
|
|
||||||
|
diff --git a/internal/api/api.go b/internal/api/api.go
|
||||||
|
index d9016fd0..924ce018 100644
|
||||||
|
--- a/internal/api/api.go
|
||||||
|
+++ b/internal/api/api.go
|
||||||
|
@@ -175,7 +175,7 @@ func NewAPIWithVersion(ctx context.Context, globalConfig *conf.GlobalConfigurati
|
||||||
|
})
|
||||||
|
|
||||||
|
r.Route("/sso", func(r *router) {
|
||||||
|
- r.Use(api.requireSAMLEnabled)
|
||||||
|
+ // r.Use(api.requireSAMLEnabled)
|
||||||
|
r.With(api.limitHandler(
|
||||||
|
// Allow requests at the specified rate per 5 minutes.
|
||||||
|
tollbooth.NewLimiter(api.config.RateLimitSso/(60*5), &limiter.ExpirableOptions{
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
-- This will be run before appflowy-cloud or gotrue does its migration
|
||||||
|
|
||||||
-- Add migration script here
|
-- Add migration script here
|
||||||
-- Create the anon and authenticated roles if they don't exist
|
-- Create the anon and authenticated roles if they don't exist
|
||||||
CREATE OR REPLACE FUNCTION create_roles(roles text []) RETURNS void LANGUAGE plpgsql AS $$
|
CREATE OR REPLACE FUNCTION create_roles(roles text []) RETURNS void LANGUAGE plpgsql AS $$
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue