Remove all mentions of --external-assets
This commit is contained in:
1 parent
6787fb1838
commit
586f9ca077
6 files changed
+28
-85
No files matched your search
+17
-39
@@ -9,37 +9,20 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event.head_commit.author.name != 'actions'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v2.1.3
|
- uses: actions/setup-node@v2
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- uses: bahmutov/npm-install@v1
|
- uses: bahmutov/npm-install@v1
|
||||||
- run: yarn build
|
- run: yarn build
|
||||||
- run: echo $(node -e 'console.log(require("url").parse(require("./package.json").homepage).host)') > build/CNAME
|
|
||||||
- run: npx keycloakify
|
- run: npx keycloakify
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: standalone_keycloak_theme
|
|
||||||
path: build_keycloak/target/*keycloak-theme*.jar
|
|
||||||
- run: npx keycloakify --external-assets
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: keycloak_theme
|
|
||||||
path: build_keycloak/target/*keycloak-theme*.jar
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: build
|
|
||||||
path: build
|
|
||||||
|
|
||||||
check_if_version_upgraded:
|
check_if_version_upgraded:
|
||||||
name: Check if version upgrade
|
name: Check if version upgrade
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: test
|
||||||
outputs:
|
outputs:
|
||||||
from_version: ${{ steps.step1.outputs.from_version }}
|
from_version: ${{ steps.step1.outputs.from_version }}
|
||||||
to_version: ${{ steps.step1.outputs.to_version }}
|
to_version: ${{ steps.step1.outputs.to_version }}
|
||||||
@@ -53,29 +36,23 @@ jobs:
|
|||||||
|
|
||||||
create_github_release:
|
create_github_release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs: check_if_version_upgraded
|
||||||
- check_if_version_upgraded
|
|
||||||
# We create a release only if the version have been upgraded and we are on a default branch
|
# We create a release only if the version have been upgraded and we are on a default branch
|
||||||
if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' && github.event_name == 'push'
|
if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' && github.event_name == 'push'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
- uses: actions/setup-node@v2
|
||||||
name: keycloak_theme
|
- uses: bahmutov/npm-install@v1
|
||||||
- run: mkdir jars
|
- run: yarn build
|
||||||
- run: mv *keycloak-theme*.jar jars/keycloak-theme.jar
|
- run: npx keycloakify
|
||||||
- uses: actions/download-artifact@v2
|
- run: mv build_keycloak/target/*keycloak-theme*.jar keycloak-theme.jar
|
||||||
with:
|
|
||||||
name: standalone_keycloak_theme
|
|
||||||
- run: mv *keycloak-theme*.jar jars/standalone-keycloak-theme.jar
|
|
||||||
- uses: softprops/action-gh-release@v1
|
- uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }}
|
name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }}
|
||||||
tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }}
|
tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }}
|
||||||
target_commitish: ${{ github.head_ref || github.ref }}
|
target_commitish: ${{ github.head_ref || github.ref }}
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
files: |
|
files: keycloak-theme.jar
|
||||||
jars/keycloak-theme.jar
|
|
||||||
jars/standalone-keycloak-theme.jar
|
|
||||||
draft: false
|
draft: false
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -114,16 +91,17 @@ jobs:
|
|||||||
tags: ${{ steps.step1.outputs.docker_tags }}
|
tags: ${{ steps.step1.outputs.docker_tags }}
|
||||||
file: Dockerfile.ci
|
file: Dockerfile.ci
|
||||||
|
|
||||||
github_pages_app:
|
github_pages:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- create_github_release
|
- create_github_release
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
- uses: bahmutov/npm-install@v1
|
||||||
name: build
|
- run: yarn build
|
||||||
path: build
|
# We tell GitHub pages that our package.json["homepage"] field is our domain name.
|
||||||
|
- run: echo $(node -e 'console.log(require("url").parse(require("./package.json").homepage).host)') > build/CNAME
|
||||||
- run: git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${{github.repository}}.git
|
- run: git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${{github.repository}}.git
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
# This is an alternative Dockerfile
|
|
||||||
# that aims to be used in the CI pipeline.
|
|
||||||
# In this version we assume that the app have been build (yarn build that generate ./build/)
|
|
||||||
# prior and archived into a build.tar file present in the context.
|
|
||||||
# We do do that because
|
|
||||||
# 1) We want to avoid building the app twice, one for the docker image and one for the theme .tar
|
|
||||||
# 2) If we use keycloakify --external-assets we have to generate the theme from the build/ directory
|
|
||||||
# that is going to be in production. (CRA generates hashes, every build is different, even if the code is the same)
|
|
||||||
|
|
||||||
# build environment
|
|
||||||
FROM alpine as build
|
|
||||||
WORKDIR /app
|
|
||||||
#We use ADD instead of COPY because build/ is in .dockerignore
|
|
||||||
ADD build.tar .
|
|
||||||
COPY nginx.conf .
|
|
||||||
|
|
||||||
# production environment (copy pasted from ./Dockerfile)
|
|
||||||
FROM nginx:stable-alpine
|
|
||||||
COPY --from=build /app/build /usr/share/nginx/html
|
|
||||||
COPY --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
CMD nginx -g 'daemon off;'
|
|
||||||
@@ -65,25 +65,14 @@ npx download-builtin-keycloak-theme
|
|||||||
|
|
||||||
If you want an example of an app that put that setup in production checkout onyxia-ui: [the repo](https://github.com/InseeFrLab/onyxia-ui), [the login](https://auth.lab.sspcloud.fr/auth/realms/sspcloud/protocol/openid-connect/auth?client_id=onyxia&redirect_uri=https%3A%2F%2Fonyxia.lab.sspcloud.fr), [the app](https://datalab.sspcloud.fr).
|
If you want an example of an app that put that setup in production checkout onyxia-ui: [the repo](https://github.com/InseeFrLab/onyxia-ui), [the login](https://auth.lab.sspcloud.fr/auth/realms/sspcloud/protocol/openid-connect/auth?client_id=onyxia&redirect_uri=https%3A%2F%2Fonyxia.lab.sspcloud.fr), [the app](https://datalab.sspcloud.fr).
|
||||||
|
|
||||||
# Standalone vs `--external-assets`
|
|
||||||
|
|
||||||
The CI creates two jars
|
|
||||||
- `keycloak-theme.jar`: Generated with `npx keycloakify --external-assets`, the assets, located `static/**/*`, like for example
|
|
||||||
`static/js/main.<hash>.js` will be downloaded from `https://starter.keycloakify.dev/static/js/main.<hash>.js` (`starter.keycloakify.dev` is
|
|
||||||
specified in the `package.json`.
|
|
||||||
- `standalone-keycloak-theme.jar`: Generated with `npx keycloakify`, this theme is fully standalone, all assets will be served by the
|
|
||||||
Keycloak server, for example `static/js/main.<hash>.js` will be downloaded from an url like `http://<your keycloak url>/resources/xxxx/login/keycloakify-starter/build/static/js/main.<hash>.js`.
|
|
||||||
|
|
||||||
More info on the `--external-assets` build option [here](https://docs.keycloakify.dev/v/v6/build-options#external-assets).
|
|
||||||
|
|
||||||
# Docker
|
# Docker
|
||||||
|
|
||||||
```bash
|
Instructions for building and running the react app (`src/App`) that is collocated with our Keycloak theme.
|
||||||
docker build -f Dockerfile -t codegouvfr/keycloakify-starter:test .
|
|
||||||
#OR (to reproduce how the image is built in the ci workflow):
|
|
||||||
yarn && yarn build && tar -cvf build.tar ./build && docker build -f Dockerfile.ci -t codegouvfr/keycloakify-starter:test . && rm build.tar
|
|
||||||
|
|
||||||
docker run -it -dp 8083:80 codegouvfr/keycloakify-starter:test
|
```bash
|
||||||
|
docker build -f Dockerfile -t keycloakify/keycloakify-starter:main .
|
||||||
|
docker run -it -dp 8083:80 keycloakify/keycloakify-starter:main
|
||||||
|
# You can access the app at http://localhost:8083
|
||||||
```
|
```
|
||||||
|
|
||||||
# Standalone keycloak theme
|
# Standalone keycloak theme
|
||||||
|
|||||||
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user