diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0ff64b2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.git +.gitea +.claude +.DS_Store +docs/ +assets/ +landing.html +*.md +k3s/ diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..8881a63 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,62 @@ +name: Build & Deploy + +on: + push: + branches: [main] + +env: + REGISTRY: git.arthurbarre.fr + IMAGE: ordinarthur/rubis + NAMESPACE: rubis + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to Gitea Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ordinarthur + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build and push image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest + ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }} + + - name: Install kubectl + run: | + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl + mv kubectl /usr/local/bin/ + + - name: Deploy to K3s + run: | + mkdir -p ~/.kube + echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config + chmod 600 ~/.kube/config + + kubectl apply -f k3s/namespace.yml + + kubectl -n $NAMESPACE create secret docker-registry gitea-registry \ + --docker-server=$REGISTRY \ + --docker-username=ordinarthur \ + --docker-password=${{ secrets.REGISTRY_PASSWORD }} \ + --dry-run=client -o yaml | kubectl apply -f - + + kubectl apply -f k3s/deployment.yml + kubectl apply -f k3s/service.yml + + kubectl -n $NAMESPACE set image deployment/rubis \ + rubis=$REGISTRY/$IMAGE:${{ github.sha }} + + kubectl -n $NAMESPACE rollout status deployment/rubis --timeout=120s diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8f2e64f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +node_modules/ +.env +.env.local diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4c187e0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM nginx:1.27-alpine + +COPY public/ /usr/share/nginx/html/ + +RUN printf 'server {\n\ + listen 80;\n\ + server_name _;\n\ + root /usr/share/nginx/html;\n\ + index index.html;\n\ +\n\ + location / {\n\ + try_files $uri $uri/ /index.html;\n\ + }\n\ +\n\ + location ~* \\.(?:css|js|svg|png|jpg|jpeg|gif|ico|webp|woff2?)$ {\n\ + expires 7d;\n\ + add_header Cache-Control "public, max-age=604800, immutable";\n\ + }\n\ +\n\ + location = /site.webmanifest {\n\ + add_header Content-Type application/manifest+json;\n\ + }\n\ +}\n' > /etc/nginx/conf.d/default.conf + +EXPOSE 80 diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..fcd78de Binary files /dev/null and b/assets/logo.png differ diff --git a/k3s/deployment.yml b/k3s/deployment.yml new file mode 100644 index 0000000..3215025 --- /dev/null +++ b/k3s/deployment.yml @@ -0,0 +1,45 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rubis + namespace: rubis + labels: + app: rubis +spec: + replicas: 1 + selector: + matchLabels: + app: rubis + template: + metadata: + labels: + app: rubis + spec: + imagePullSecrets: + - name: gitea-registry + containers: + - name: rubis + image: git.arthurbarre.fr/ordinarthur/rubis:latest + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 80 + resources: + requests: + memory: "32Mi" + cpu: "10m" + limits: + memory: "128Mi" + cpu: "200m" + readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 3 + periodSeconds: 10 + livenessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 10 + periodSeconds: 30 diff --git a/k3s/namespace.yml b/k3s/namespace.yml new file mode 100644 index 0000000..8ecc111 --- /dev/null +++ b/k3s/namespace.yml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: rubis diff --git a/k3s/service.yml b/k3s/service.yml new file mode 100644 index 0000000..95c51dc --- /dev/null +++ b/k3s/service.yml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: rubis + namespace: rubis +spec: + type: NodePort + selector: + app: rubis + ports: + - name: http + port: 80 + targetPort: 80 + nodePort: 30109 diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 0000000..024ba7f Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/favicon-96x96.png b/public/favicon-96x96.png new file mode 100644 index 0000000..66fa2bf Binary files /dev/null and b/public/favicon-96x96.png differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..af52c09 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..162a2cd --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,3 @@ +RealFaviconGeneratorhttps://realfavicongenerator.net \ No newline at end of file diff --git a/landing.html b/public/index.html similarity index 99% rename from landing.html rename to public/index.html index fe79b62..42c3198 100644 --- a/landing.html +++ b/public/index.html @@ -16,6 +16,13 @@ + + + + + + +