-
Notifications
You must be signed in to change notification settings - Fork 154
feat: enable standalone UI in docker-compose with configurable deployment mode #2056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Source code for the repos | ||
| ARG UI_SOURCE_CODE=./frontend | ||
| ARG BFF_SOURCE_CODE=./bff | ||
|
|
||
| # Set the base images for the build stages | ||
| ARG NODE_BASE_IMAGE=node:22 | ||
| ARG GOLANG_BASE_IMAGE=golang:1.24.6 | ||
| ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot | ||
|
|
||
| # UI build stage | ||
| FROM ${NODE_BASE_IMAGE} AS ui-builder | ||
|
|
||
| ARG UI_SOURCE_CODE | ||
| ARG DEPLOYMENT_MODE | ||
| ARG STYLE_THEME | ||
|
|
||
| WORKDIR /usr/src/app | ||
|
|
||
| # Copy the source code to the container | ||
| COPY ${UI_SOURCE_CODE} /usr/src/app | ||
|
|
||
| # Install the dependencies and build | ||
| RUN npm cache clean --force | ||
| RUN npm ci --omit=optional | ||
| RUN DEPLOYMENT_MODE=${DEPLOYMENT_MODE} STYLE_THEME=${STYLE_THEME} npm run build:prod | ||
|
|
||
| # BFF build stage | ||
| FROM ${GOLANG_BASE_IMAGE} AS bff-builder | ||
|
|
||
| ARG BFF_SOURCE_CODE | ||
|
|
||
| ARG TARGETOS | ||
| ARG TARGETARCH | ||
|
|
||
| WORKDIR /usr/src/app | ||
|
|
||
| # Copy the Go Modules manifests | ||
| COPY ${BFF_SOURCE_CODE}/go.mod ${BFF_SOURCE_CODE}/go.sum ./ | ||
|
|
||
| # Download dependencies | ||
| RUN go mod download | ||
|
|
||
| # Copy the go source files | ||
| COPY ${BFF_SOURCE_CODE}/cmd/ cmd/ | ||
| COPY ${BFF_SOURCE_CODE}/internal/ internal/ | ||
|
|
||
| # Build the Go application | ||
| RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o bff ./cmd | ||
|
|
||
| # Install setup-envtest and download K8s binaries for mock mode | ||
| RUN go install sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.17 | ||
| RUN setup-envtest use 1.29.0 --bin-dir /envtest-bin -p path | ||
|
|
||
| # Final stage | ||
| # Use distroless as minimal base image to package the application binary | ||
| FROM ${DISTROLESS_BASE_IMAGE} | ||
| WORKDIR / | ||
| COPY --from=bff-builder /usr/src/app/bff ./ | ||
| COPY --from=ui-builder /usr/src/app/dist ./static/ | ||
| # Copy envtest binaries for mock K8s mode | ||
| COPY --from=bff-builder /envtest-bin /envtest-bin | ||
| ENV ENVTEST_ASSETS_DIR=/envtest-bin | ||
| USER 65532:65532 | ||
|
|
||
| # Expose port 8080 | ||
| EXPOSE 8080 | ||
|
|
||
| ENTRYPOINT ["/bff"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.