diff --git a/Dockerfile b/Dockerfile index 6e0fdc8..bd788f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ -ARG BASE_IMAGE=ekidd/rust-musl-builder:latest +ARG BASE_IMAGE=docker.io/ekidd/rust-musl-builder:latest FROM ${BASE_IMAGE} AS builder +RUN sudo apt-get update && sudo apt-get install -y clang + ADD --chown=rust:rust . ./ RUN cargo build --release diff --git a/chart/Chart.yaml b/chart/Chart.yaml new file mode 100644 index 0000000..82430a9 --- /dev/null +++ b/chart/Chart.yaml @@ -0,0 +1,16 @@ +apiVersion: v2 +name: leetbot +description: Telegram bot that counts leet points + +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "0.1.0" diff --git a/chart/templates/cm.yml b/chart/templates/cm.yml new file mode 100644 index 0000000..36fde41 --- /dev/null +++ b/chart/templates/cm.yml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-cm +data: + TZ: {{ .Values.app.tz }} diff --git a/chart/templates/deployment.yml b/chart/templates/deployment.yml new file mode 100644 index 0000000..a2d31ac --- /dev/null +++ b/chart/templates/deployment.yml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }} + labels: + release: {{ .Release.Name }} +spec: + selector: + matchLabels: + release: {{ .Release.Name }} + replicas: 1 + template: + metadata: + labels: + release: {{ .Release.Name }} + spec: + containers: + - image: {{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }} + name: leetbot + envFrom: + - secretRef: + name: {{ .Release.Name }}-token + - configMapRef: + name: {{ .Release.Name }}-cm + {{- if .Values.storage.enabled }} + volumeMounts: + - name: app-data + mountPath: '/app' + readOnly: false + {{- end }} + volumes: + {{- if .Values.storage.enabled }} + - name: app-data + persistentVolumeClaim: + claimName: {{ .Release.Name }}-pvc + {{- end }} diff --git a/chart/templates/pvc.yml b/chart/templates/pvc.yml new file mode 100644 index 0000000..d484068 --- /dev/null +++ b/chart/templates/pvc.yml @@ -0,0 +1,15 @@ +{{- if .Values.storage.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-pvc + labels: + release: {{ .Release.Name }} +spec: + accessModes: + - ReadWriteOnce + storageClassName: {{ .Values.storage.storageClass }} + resources: + requests: + storage: 1Gi +{{- end }} diff --git a/chart/templates/secret.yml b/chart/templates/secret.yml new file mode 100644 index 0000000..dddda32 --- /dev/null +++ b/chart/templates/secret.yml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }}-token +data: + DISCORD_TOKEN: {{ .Values.app.token | b64enc }} diff --git a/chart/values.yaml b/chart/values.yaml new file mode 100644 index 0000000..77bcba7 --- /dev/null +++ b/chart/values.yaml @@ -0,0 +1,10 @@ +image: + repository: registry.local/mollux/rollux + +app: + token: blabla + tz: Europe/Oslo + +storage: + enabled: false + storageClass: local-path