build: add .drone.yml
This commit is contained in:
parent
5052c7bf81
commit
bb27b33c5b
|
@ -0,0 +1,84 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: linux-amd64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: publish
|
||||
image: plugins/docker
|
||||
settings:
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
registry: gitea.dwysokinski.me
|
||||
repo: gitea.dwysokinski.me/twhelp-packages/scripts
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64
|
||||
dockerfile: Dockerfile
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: manifest
|
||||
|
||||
steps:
|
||||
- name: manifest
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
auto_tag: "true"
|
||||
ignore_missing: "true"
|
||||
spec: manifest.tmpl
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
- name: manifest-latest
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
tags: latest
|
||||
ignore_missing: "true"
|
||||
spec: manifest.tmpl
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
|
||||
depends_on:
|
||||
- linux-amd64
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: deploy
|
||||
|
||||
steps:
|
||||
- name: deploy-k8s
|
||||
image: alpine/k8s:1.25.5
|
||||
environment:
|
||||
KUBECONFIG:
|
||||
from_secret: kubeconfig
|
||||
commands:
|
||||
- "mkdir ~/.kube && echo \"$KUBECONFIG\" > ~/.kube/twhelp"
|
||||
- "cd ./k8s/overlays/prod && kustomize edit set image scripts=gitea.dwysokinski.me/twhelp-packages/scripts:${DRONE_TAG##v} && cd ../../.."
|
||||
- kustomize build ./k8s/overlays/prod | kubectl --kubeconfig ~/.kube/twhelp apply -n twhelp -f -
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
---
|
||||
kind: signature
|
||||
hmac: b03cbfdb69c54f0762033201c913f1660ff205f43c85139f0a79ec7425cbae15
|
||||
|
||||
...
|
|
@ -2,4 +2,7 @@
|
|||
root * /var/www
|
||||
file_server
|
||||
header -Server
|
||||
header Cache-Control max-age=3600
|
||||
header /quickbar/*.js Content-type "text/javascript; charset=UTF-8"
|
||||
header /userscripts/*.js Content-type "text/javascript; charset=UTF-8"
|
||||
}
|
||||
|
|
|
@ -11,5 +11,4 @@ RUN yarn build
|
|||
FROM caddy:2.6.2-alpine
|
||||
|
||||
COPY --from=build-deps /app/dist /var/www
|
||||
COPY --from=build-deps /app/static /var/www
|
||||
COPY Caddyfile /etc/caddy/Caddyfile
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: scripts-caddy-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: scripts-caddy
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: scripts-caddy
|
||||
spec:
|
||||
containers:
|
||||
- name: scripts-caddy
|
||||
image: scripts
|
||||
ports:
|
||||
- name: container-port
|
||||
containerPort: 80
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /quickbar/extendedPlayerProfile.js
|
||||
port: container-port
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /quickbar/extendedPlayerProfile.js
|
||||
port: container-port
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: scripts-caddy-service
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
app: scripts-caddy
|
|
@ -0,0 +1,8 @@
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- caddy.yml
|
||||
images:
|
||||
- name: scripts
|
||||
newName: scripts
|
||||
newTag: latest
|
|
@ -0,0 +1,20 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: twhelp-caddy-ingress
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: "web"
|
||||
traefik.ingress.kubernetes.io/router.tls: "false"
|
||||
traefik.ingress.kubernetes.io/router.middlewares: kube-system-compress@kubernetescrd
|
||||
spec:
|
||||
rules:
|
||||
- host: scripts.tribalwarshelp.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: twhelp-caddy-service
|
||||
port:
|
||||
number: 80
|
|
@ -0,0 +1,6 @@
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: twhelp
|
||||
resources:
|
||||
- ../../base
|
||||
- ingress.yml
|
|
@ -0,0 +1,13 @@
|
|||
image: gitea.dwysokinski.me/twhelp-packages/scripts:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||
{{#if build.tags}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
-
|
||||
image: gitea.dwysokinski.me/twhelp-packages/scripts:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
Loading…
Reference in New Issue