feat: initial landing page with K8s deploy config
- Nginx static serving with APP_URL env var - K8s manifests for prod and staging - Gitea Actions CI/CD pipeline
This commit is contained in:
52
.gitea/workflows/deploy.yml
Normal file
52
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
name: Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push-prod:
|
||||||
|
name: Build & Push (Prod)
|
||||||
|
runs-on: heavy
|
||||||
|
container: git.batida.io/batida/ci-node:latest
|
||||||
|
steps:
|
||||||
|
- uses: https://git.batida.io/batida/actions-checkout@v4
|
||||||
|
- name: Login to registry
|
||||||
|
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.batida.io -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||||
|
- name: Build and push
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
--build-arg APP_URL=https://app.batida.io \
|
||||||
|
-t git.batida.io/batida/batida-landing:${{ github.sha }} \
|
||||||
|
-t git.batida.io/batida/batida-landing:latest \
|
||||||
|
.
|
||||||
|
docker push git.batida.io/batida/batida-landing:${{ github.sha }}
|
||||||
|
docker push git.batida.io/batida/batida-landing:latest
|
||||||
|
|
||||||
|
deploy-staging:
|
||||||
|
name: Deploy Staging
|
||||||
|
runs-on: heavy
|
||||||
|
needs: [build-and-push-prod]
|
||||||
|
container: git.batida.io/batida/ci-node:latest
|
||||||
|
steps:
|
||||||
|
- name: Deploy to staging
|
||||||
|
run: |
|
||||||
|
echo "$KUBECONFIG_CONTENT" > /tmp/kubeconfig
|
||||||
|
kubectl --kubeconfig /tmp/kubeconfig set image deployment/batida-landing batida-landing=git.batida.io/batida/batida-landing:${{ github.sha }} -n staging
|
||||||
|
kubectl --kubeconfig /tmp/kubeconfig rollout status deployment/batida-landing -n staging --timeout=120s
|
||||||
|
env:
|
||||||
|
KUBECONFIG_CONTENT: ${{ secrets.KUBECONFIG }}
|
||||||
|
|
||||||
|
deploy-prod:
|
||||||
|
name: Deploy Prod
|
||||||
|
runs-on: heavy
|
||||||
|
needs: [deploy-staging]
|
||||||
|
container: git.batida.io/batida/ci-node:latest
|
||||||
|
steps:
|
||||||
|
- name: Deploy to prod
|
||||||
|
run: |
|
||||||
|
echo "$KUBECONFIG_CONTENT" > /tmp/kubeconfig
|
||||||
|
kubectl --kubeconfig /tmp/kubeconfig set image deployment/batida-landing batida-landing=git.batida.io/batida/batida-landing:${{ github.sha }} -n prod
|
||||||
|
kubectl --kubeconfig /tmp/kubeconfig rollout status deployment/batida-landing -n prod --timeout=120s
|
||||||
|
env:
|
||||||
|
KUBECONFIG_CONTENT: ${{ secrets.KUBECONFIG }}
|
||||||
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
ARG APP_URL=https://app.batida.io
|
||||||
|
|
||||||
|
COPY index.html /tmp/index.html
|
||||||
|
RUN sed -i "s|{{APP_URL}}|${APP_URL}|g" /tmp/index.html
|
||||||
|
RUN mv /tmp/index.html /usr/share/nginx/html/index.html
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
1828
index.html
Normal file
1828
index.html
Normal file
File diff suppressed because it is too large
Load Diff
52
k8s/prod.yaml
Normal file
52
k8s/prod.yaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: batida-landing
|
||||||
|
namespace: prod
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: batida-landing
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: batida-landing
|
||||||
|
spec:
|
||||||
|
tolerations:
|
||||||
|
- key: prod
|
||||||
|
operator: Equal
|
||||||
|
value: "true"
|
||||||
|
effect: NoSchedule
|
||||||
|
nodeSelector:
|
||||||
|
dedicated: prod
|
||||||
|
containers:
|
||||||
|
- name: batida-landing
|
||||||
|
image: git.batida.io/batida/batida-landing:latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 80
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 30
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "16Mi"
|
||||||
|
cpu: "10m"
|
||||||
|
limits:
|
||||||
|
memory: "64Mi"
|
||||||
|
cpu: "100m"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: batida-landing
|
||||||
|
namespace: prod
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: batida-landing
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 80
|
||||||
52
k8s/staging.yaml
Normal file
52
k8s/staging.yaml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: batida-landing
|
||||||
|
namespace: staging
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: batida-landing
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: batida-landing
|
||||||
|
spec:
|
||||||
|
tolerations:
|
||||||
|
- key: staging
|
||||||
|
operator: Equal
|
||||||
|
value: "true"
|
||||||
|
effect: NoSchedule
|
||||||
|
nodeSelector:
|
||||||
|
dedicated: staging
|
||||||
|
containers:
|
||||||
|
- name: batida-landing
|
||||||
|
image: git.batida.io/batida/batida-landing:staging-latest
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 80
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 30
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "16Mi"
|
||||||
|
cpu: "10m"
|
||||||
|
limits:
|
||||||
|
memory: "64Mi"
|
||||||
|
cpu: "100m"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: batida-landing
|
||||||
|
namespace: staging
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: batida-landing
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 80
|
||||||
Reference in New Issue
Block a user