Skip to content

Commit f6321db

Browse files
authored
Merge pull request #84 from wiseflat/dev/ui-nextjs
Add UI nextjs
2 parents fbd813e + 422e42d commit f6321db

332 files changed

Lines changed: 32965 additions & 499 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Administration credentials
2+
TEMP_ADMIN_EMAIL=admin@example.com
3+
TEMP_ADMIN_PASSWORD=change-me-securely
4+
5+
# UI Next configuration
6+
# URL interne du réseau Docker pour accéder au service ui-next
7+
# Format: http://ui-next:3000 (accès interne) ou http://localhost:3000 (accès local)
8+
SIMPLE_STACK_UI_URL=http://ui-next:3000
9+
10+
# UI authentication (mapped from admin credentials)
11+
SIMPLE_STACK_UI_USER=${TEMP_ADMIN_EMAIL}
12+
SIMPLE_STACK_UI_PASSWORD=${TEMP_ADMIN_PASSWORD}
13+
14+
# Terraform HTTP backend authentication
15+
TF_HTTP_USERNAME=${TEMP_ADMIN_EMAIL}
16+
TF_HTTP_PASSWORD=${TEMP_ADMIN_PASSWORD}
17+
18+
# NextAuth secret for session encryption
19+
NEXTAUTH_SECRET=your-secret-key-change-in-production
20+
21+
# Optional: Custom ports
22+
UI_NEXT_PORT=3000
23+
24+
# Optional: Ansible Java version
25+
ANSIBLE_JAVA_VERSION=21

.github/workflows/docker-build.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Reusable – Docker build and push
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
image_name:
7+
description: "Full image name without registry prefix (e.g. owner/repo-ui)"
8+
required: true
9+
type: string
10+
context:
11+
description: "Docker build context path"
12+
required: true
13+
type: string
14+
version:
15+
description: "Image tag / version to apply"
16+
required: true
17+
type: string
18+
registry:
19+
description: "Container registry hostname"
20+
required: false
21+
type: string
22+
default: ghcr.io
23+
push:
24+
description: "Whether to push and sign the image"
25+
required: false
26+
type: boolean
27+
default: false
28+
secrets:
29+
registry_token:
30+
required: true
31+
32+
jobs:
33+
build:
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
37+
packages: write
38+
id-token: write
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
43+
- name: Install cosign
44+
if: ${{ inputs.push }}
45+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
46+
with:
47+
cosign-release: 'v2.2.4'
48+
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
51+
52+
- name: Log into registry ${{ inputs.registry }}
53+
if: ${{ inputs.push }}
54+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
55+
with:
56+
registry: ${{ inputs.registry }}
57+
username: ${{ github.actor }}
58+
password: ${{ secrets.registry_token }}
59+
60+
- name: Extract Docker metadata
61+
id: meta
62+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
63+
with:
64+
images: ${{ inputs.registry }}/${{ inputs.image_name }}
65+
tags: ${{ inputs.version }}
66+
67+
- name: Build and push Docker image
68+
id: build-and-push
69+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
70+
with:
71+
context: ${{ inputs.context }}
72+
push: ${{ inputs.push }}
73+
tags: ${{ steps.meta.outputs.tags }}
74+
labels: ${{ steps.meta.outputs.labels }}
75+
cache-from: type=gha
76+
cache-to: type=gha,mode=max
77+
78+
- name: Sign the published Docker image
79+
if: ${{ inputs.push }}
80+
env:
81+
TAGS: ${{ steps.meta.outputs.tags }}
82+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
83+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.github/workflows/docker-publish.yml

Lines changed: 72 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -2,153 +2,98 @@ name: Docker
22

33
on:
44
push:
5-
branches: [ "main" ]
6-
# Publish semver tags as releases.
7-
tags: [ 'v*.*.*' ]
5+
branches: ["main"]
6+
tags: ["v*.*.*"]
87
pull_request:
9-
branches: [ "main" ]
10-
11-
env:
12-
REGISTRY: ghcr.io
13-
IMAGE_NAME_UI: ${{ github.repository }}-ui
14-
IMAGE_NAME_ANSIBLE: ${{ github.repository }}-ansible
8+
branches: ["main"]
159

1610
permissions:
1711
contents: write
1812
packages: write
1913
id-token: write
2014

2115
jobs:
22-
build-ui:
16+
setup:
2317
runs-on: ubuntu-latest
24-
permissions:
25-
contents: read
26-
packages: write
27-
id-token: write
18+
outputs:
19+
version: ${{ steps.version.outputs.value }}
2820
steps:
29-
- name: Checkout repository
30-
uses: actions/checkout@v4
31-
32-
- name: Install cosign
33-
if: github.event_name != 'pull_request'
34-
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
35-
with:
36-
cosign-release: 'v2.2.4'
37-
38-
- name: Set up Docker Buildx
39-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
40-
41-
- name: Log into registry ${{ env.REGISTRY }}
42-
if: github.event_name != 'pull_request'
43-
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
44-
with:
45-
registry: ${{ env.REGISTRY }}
46-
username: ${{ github.actor }}
47-
password: ${{ secrets.GITHUB_TOKEN }}
48-
49-
- name: Set version (SemVer)
50-
id: set_version
51-
run: echo "VERSION=v0.0.${{ github.run_number }}" >> $GITHUB_ENV
52-
53-
- name: Extract Docker UI metadata
54-
id: meta-ui
55-
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
56-
with:
57-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_UI }}
58-
tags: ${{ env.VERSION }}
59-
60-
- name: Build and push UI Docker image
61-
id: build-and-push-ui
62-
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
63-
with:
64-
context: ui/.
65-
push: ${{ github.event_name != 'pull_request' }}
66-
tags: ${{ steps.meta-ui.outputs.tags }}
67-
labels: ${{ steps.meta-ui.outputs.labels }}
68-
cache-from: type=gha
69-
cache-to: type=gha,mode=max
70-
71-
- name: Sign the published UI Docker image
72-
if: ${{ github.event_name != 'pull_request' }}
73-
env:
74-
TAGS: ${{ steps.meta-ui.outputs.tags }}
75-
DIGEST: ${{ steps.build-and-push-ui.outputs.digest }}
76-
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
77-
78-
build-ansible:
21+
- name: Compute version
22+
id: version
23+
run: |
24+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
25+
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
26+
else
27+
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
28+
echo "value=sha-${SHORT_SHA}" >> $GITHUB_OUTPUT
29+
fi
30+
31+
quality:
7932
runs-on: ubuntu-latest
80-
permissions:
81-
contents: read
82-
packages: write
83-
id-token: write
33+
defaults:
34+
run:
35+
working-directory: ui-next
8436
steps:
85-
- name: Checkout repository
86-
uses: actions/checkout@v4
87-
88-
- name: Install cosign
89-
if: github.event_name != 'pull_request'
90-
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
91-
with:
92-
cosign-release: 'v2.2.4'
93-
94-
- name: Set up Docker Buildx
95-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
96-
97-
- name: Log into registry ${{ env.REGISTRY }}
98-
if: github.event_name != 'pull_request'
99-
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
100-
with:
101-
registry: ${{ env.REGISTRY }}
102-
username: ${{ github.actor }}
103-
password: ${{ secrets.GITHUB_TOKEN }}
104-
105-
- name: Set version (SemVer)
106-
id: set_version
107-
run: echo "VERSION=v0.0.${{ github.run_number }}" >> $GITHUB_ENV
108-
109-
- name: Extract Docker Ansible metadata
110-
id: meta-ansible
111-
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-node@v4
11239
with:
113-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_ANSIBLE }}
114-
tags: ${{ env.VERSION }}
40+
node-version: 22
41+
cache: npm
42+
cache-dependency-path: ui-next/package-lock.json
43+
- name: Install dependencies
44+
run: npm install
45+
- name: Lint
46+
run: npm run lint
47+
- name: Build check
48+
run: npm run build
49+
env:
50+
AUTH_SECRET: ci-placeholder
51+
DATABASE_URL: ":memory:"
11552

116-
- name: Build and push Ansible Docker image
117-
id: build-and-push-ansible
118-
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
119-
with:
120-
context: ansible/.
121-
push: ${{ github.event_name != 'pull_request' }}
122-
tags: ${{ steps.meta-ansible.outputs.tags }}
123-
labels: ${{ steps.meta-ansible.outputs.labels }}
124-
cache-from: type=gha
125-
cache-to: type=gha,mode=max
53+
build-ui:
54+
needs: [setup, quality]
55+
uses: ./.github/workflows/docker-build.yml
56+
with:
57+
image_name: ${{ github.repository }}-ui
58+
context: ui/.
59+
version: ${{ needs.setup.outputs.version }}
60+
registry: ghcr.io
61+
push: ${{ github.event_name != 'pull_request' }}
62+
secrets:
63+
registry_token: ${{ secrets.GITHUB_TOKEN }}
64+
65+
build-ui-next:
66+
needs: [setup, quality]
67+
uses: ./.github/workflows/docker-build.yml
68+
with:
69+
image_name: ${{ github.repository }}-ui-next
70+
context: ui-next/.
71+
version: ${{ needs.setup.outputs.version }}
72+
registry: ghcr.io
73+
push: ${{ github.event_name != 'pull_request' }}
74+
secrets:
75+
registry_token: ${{ secrets.GITHUB_TOKEN }}
12676

127-
- name: Sign the published Ansible Docker image
128-
if: ${{ github.event_name != 'pull_request' }}
129-
env:
130-
TAGS: ${{ steps.meta-ansible.outputs.tags }}
131-
DIGEST: ${{ steps.build-and-push-ansible.outputs.digest }}
132-
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
77+
build-ansible:
78+
needs: [setup, quality]
79+
uses: ./.github/workflows/docker-build.yml
80+
with:
81+
image_name: ${{ github.repository }}-ansible
82+
context: ansible/.
83+
version: ${{ needs.setup.outputs.version }}
84+
registry: ghcr.io
85+
push: ${{ github.event_name != 'pull_request' }}
86+
secrets:
87+
registry_token: ${{ secrets.GITHUB_TOKEN }}
13388

13489
release:
135-
needs: [build-ui, build-ansible]
90+
needs: [build-ui, build-ui-next, build-ansible]
13691
runs-on: ubuntu-latest
13792
permissions:
13893
contents: write
139-
packages: write
140-
id-token: write
141-
if: github.ref == 'refs/heads/main'
94+
if: startsWith(github.ref, 'refs/tags/v')
14295
steps:
143-
- name: Set version (SemVer) for release
144-
run: echo "VERSION=v0.0.${{ github.run_number }}" >> $GITHUB_ENV
145-
14696
- name: Create GitHub Release
147-
uses: actions/create-release@v1
148-
env:
149-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
uses: softprops/action-gh-release@v2
15098
with:
151-
tag_name: ${{ env.VERSION }}
152-
release_name: Release ${{ env.VERSION }}
153-
draft: false
154-
prerelease: false
99+
generate_release_notes: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ ansible/group_vars
99
ansible/host_vars
1010
ansible/ssh
1111
ansible/inventory.yml
12+
13+
.devcontainer
14+
15+
ui-blueprint.md

0 commit comments

Comments
 (0)