![gcp-cherry-pick-bot[bot]](/assets/img/avatar_default.png)
core: include version in built JS files (#9558) * web: fix esbuild issue with style sheets Getting ESBuild, Lit, and Storybook to all agree on how to read and parse stylesheets is a serious pain. This fix better identifies the value types (instances) being passed from various sources in the repo to the three *different* kinds of style processors we're using (the native one, the polyfill one, and whatever the heck Storybook does internally). Falling back to using older CSS instantiating techniques one era at a time seems to do the trick. It's ugly, but in the face of the aggressive styling we use to avoid Flashes of Unstyled Content (FLoUC), it's the logic with which we're left. In standard mode, the following warning appears on the console when running a Flow: ``` Autofocus processing was blocked because a document already has a focused element. ``` In compatibility mode, the following **error** appears on the console when running a Flow: ``` crawler-inject.js:1106 Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'. at initDomMutationObservers (crawler-inject.js:1106:18) at crawler-inject.js:1114:24 at Array.forEach (<anonymous>) at initDomMutationObservers (crawler-inject.js:1114:10) at crawler-inject.js:1549:1 initDomMutationObservers @ crawler-inject.js:1106 (anonymous) @ crawler-inject.js:1114 initDomMutationObservers @ crawler-inject.js:1114 (anonymous) @ crawler-inject.js:1549 ``` Despite this error, nothing seems to be broken and flows work as anticipated. * core: include version in built JS files * add fallback * include build hash * format * fix stuff why does this even work locally * idk man node * just not use import assertions * web: add no-console, use proper dirname path * web: retarget to use the base package.json file. * web: encode path to root package.json using git This is the most authoritative way of finding the root of the git project. * use full version to match frontend * add fallback for missing .git folder --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens L <jens@goauthentik.io> Co-authored-by: Ken Sternberg <ken@goauthentik.io>
77 lines
2.6 KiB
Docker
77 lines
2.6 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# Stage 1: Build web
|
|
FROM --platform=${BUILDPLATFORM} docker.io/node:22 as web-builder
|
|
|
|
ENV NODE_ENV=production
|
|
WORKDIR /static
|
|
|
|
COPY package.json /
|
|
COPY web/package.json .
|
|
COPY web/package-lock.json .
|
|
RUN --mount=type=bind,target=/static/package.json,src=./web/package.json \
|
|
--mount=type=bind,target=/static/package-lock.json,src=./web/package-lock.json \
|
|
--mount=type=cache,target=/root/.npm \
|
|
npm ci --include=dev
|
|
|
|
COPY web .
|
|
RUN npm run build-proxy
|
|
|
|
# Stage 2: Build
|
|
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/oss/go/microsoft/golang:1.22-fips-bookworm AS builder
|
|
|
|
ARG TARGETOS
|
|
ARG TARGETARCH
|
|
ARG TARGETVARIANT
|
|
|
|
ARG GOOS=$TARGETOS
|
|
ARG GOARCH=$TARGETARCH
|
|
|
|
WORKDIR /go/src/goauthentik.io
|
|
|
|
RUN --mount=type=cache,id=apt-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/apt \
|
|
dpkg --add-architecture arm64 && \
|
|
apt-get update && \
|
|
apt-get install -y --no-install-recommends crossbuild-essential-arm64 gcc-aarch64-linux-gnu
|
|
|
|
RUN --mount=type=bind,target=/go/src/goauthentik.io/go.mod,src=./go.mod \
|
|
--mount=type=bind,target=/go/src/goauthentik.io/go.sum,src=./go.sum \
|
|
--mount=type=bind,target=/go/src/goauthentik.io/gen-go-api,src=./gen-go-api \
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
go mod download
|
|
|
|
COPY . .
|
|
RUN --mount=type=cache,sharing=locked,target=/go/pkg/mod \
|
|
--mount=type=cache,id=go-build-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/root/.cache/go-build \
|
|
if [ "$TARGETARCH" = "arm64" ]; then export CC=aarch64-linux-gnu-gcc && export CC_FOR_TARGET=gcc-aarch64-linux-gnu; fi && \
|
|
CGO_ENABLED=1 GOEXPERIMENT="systemcrypto" GOFLAGS="-tags=requirefips" GOARM="${TARGETVARIANT#v}" \
|
|
go build -o /go/proxy ./cmd/proxy
|
|
|
|
# Stage 3: Run
|
|
FROM ghcr.io/goauthentik/fips-debian:bookworm-slim-fips
|
|
|
|
ARG GIT_BUILD_HASH
|
|
ENV GIT_BUILD_HASH=$GIT_BUILD_HASH
|
|
|
|
LABEL org.opencontainers.image.url https://goauthentik.io
|
|
LABEL org.opencontainers.image.description goauthentik.io Proxy outpost image, see https://goauthentik.io for more info.
|
|
LABEL org.opencontainers.image.source https://github.com/goauthentik/authentik
|
|
LABEL org.opencontainers.image.version ${VERSION}
|
|
LABEL org.opencontainers.image.revision ${GIT_BUILD_HASH}
|
|
|
|
COPY --from=builder /go/proxy /
|
|
COPY --from=web-builder /static/robots.txt /web/robots.txt
|
|
COPY --from=web-builder /static/security.txt /web/security.txt
|
|
COPY --from=web-builder /static/dist/ /web/dist/
|
|
COPY --from=web-builder /static/authentik/ /web/authentik/
|
|
|
|
HEALTHCHECK --interval=5s --retries=20 --start-period=3s CMD [ "/proxy", "healthcheck" ]
|
|
|
|
EXPOSE 9000 9300 9443
|
|
|
|
USER 1000
|
|
|
|
ENV GOFIPS=1
|
|
|
|
ENTRYPOINT ["/proxy"]
|