Skip to content

Commit

Permalink
Add simple portal
Browse files Browse the repository at this point in the history
  • Loading branch information
berrydenhartog committed Feb 1, 2025
1 parent 9b3c0db commit 1d8e2e8
Show file tree
Hide file tree
Showing 15 changed files with 4,801 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
push:
branches:
- main

name: build

env:
IMAGE_NAME: 'mijnbureau-portal'

jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
actions: read
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/minbzk/${{ env.IMAGE_NAME }}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: portal/
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
platforms: linux/amd64

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ghcr.io/minbzk/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
portal/src/vendor/
22 changes: 22 additions & 0 deletions base/portal/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: deployment
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: portal
template:
metadata:
labels:
app.kubernetes.io/component: portal
name: deployment
spec:
containers:
- image: ghcr.io/minbzk/mijnbureau-portal:main
imagePullPolicy: Always
name: portal
ports:
- containerPort: 80
protocol: TCP
23 changes: 23 additions & 0 deletions base/portal/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
name: ingress
spec:
ingressClassName: nginx
rules:
- host: portal.la-suite.apps.digilab.network
http:
paths:
- backend:
service:
name: service
port:
number: 80
path: /
pathType: Prefix
tls:
- hosts:
- portal.la-suite.apps.digilab.network
secretName: tls
16 changes: 16 additions & 0 deletions base/portal/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
- ingress.yaml
- service.yaml

namePrefix: portal-

labels:
- pairs:
app.kubernetes.io/name: portal

buildMetadata: [originAnnotations]
#todo: use configmap generator for configmap.yaml
13 changes: 13 additions & 0 deletions base/portal/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: service
spec:
ports:
- name: portal
port: 80
protocol: TCP
targetPort: 80
selector:
app.kubernetes.io/component: portal
type: ClusterIP
1 change: 1 addition & 0 deletions overlays/digilab/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ resources:
- ../../base/vault/
- ../../base/grafana/
- ../../base/oauth2-proxy/
- ../../base/portal/

secretGenerator:
- name: sec-keycloak
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions portal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:20 as build

WORKDIR /app

COPY package.json package-lock.json webpack.config.js ./
COPY src/ ./src/

RUN npm install
RUN npm run build

FROM nginx:1.27.3

COPY --from=build /app/src /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
7 changes: 7 additions & 0 deletions portal/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
portal:
build:
context: .
image: "docker.io/portal:latest"
ports:
- "8080:80"
Loading

0 comments on commit 1d8e2e8

Please sign in to comment.