Skip to content
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

feat(deployment): Preview loculus docs pages #2452

Merged
merged 9 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/docs-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Push Docker Image for Docs

on:
workflow_dispatch:
push:
branches:
- main

env:
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/docs

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4

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

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

- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: ./docs
file: ./docs/Dockerfile
push: true
tags: |
${{ env.DOCKER_IMAGE }}:${{ github.sha }}
${{ env.DOCKER_IMAGE }}:latest

- name: Echo Image URL
run: |
echo "Docker image pushed to ${{ env.DOCKER_IMAGE }}:${{ github.sha }}"
echo "Docker image pushed to ${{ env.DOCKER_IMAGE }}:latest"
16 changes: 16 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:20-alpine
WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build

RUN npm install -g http-server

EXPOSE 8080

CMD ["http-server", "dist", "-p", "8080"]
71 changes: 71 additions & 0 deletions kubernetes/loculus/templates/docs-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{{- $dockerTag := include "loculus.dockerTag" .Values }}
{{- $docsHost := printf "docs%s%s" .Values.subdomainSeparator .Values.host }}
{{- if .Values.previewDocs }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: loculus-docs
annotations:
argocd.argoproj.io/sync-options: Replace=true
reloader.stakater.com/auto: "true"
spec:
replicas: 1
selector:
matchLabels:
app: loculus
component: docs
template:
metadata:
labels:
app: loculus
component: docs
spec:
containers:
- name: docs
image: "ghcr.io/loculus-project/docs:{{ $dockerTag }}"
imagePullPolicy: Always
resources:
requests:
memory: "200Mi"
{{ include "loculus.standardCPURequest" $ }}
limits:
memory: "1Gi"
ports:
- containerPort: 8080

---
apiVersion: v1
kind: Service
metadata:
name: loculus-docs
spec:
selector:
app: loculus
component: docs
ports:
- protocol: TCP
port: 80
targetPort: 8080

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: loculus-docs
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- host: {{ $docsHost | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: loculus-docs
port:
number: 80
{{- end }}
1 change: 1 addition & 0 deletions kubernetes/loculus/values_e2e_and_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ createTestAccounts: true
backendExtraArgs:
- "--loculus.debug-mode=true"
reduceResourceRequest: true
previewDocs: true
Loading