diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 72e6036651bd62aba5c803457aa434708b3a1fdf..2217431a265d8337587196ba478c8cb31b600137 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,12 @@ +stages: + - build + - deploy + variables: GIT_SUBMODULE_STRATEGY: recursive build docker image: + stage: build interruptible: true image: name: gcr.io/kaniko-project/executor:debug @@ -13,17 +18,14 @@ build docker image: --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME --cache=true + --digestfile=DIGESTFILE --cleanup -build pages: - image: alpine:latest - before_script: - - apk add --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ zola - - apk add yarn - - yarn install +deploy docker image: + stage: deploy + image: bitnami/kubectl:latest script: - - zola build - - cp _redirects public/ - artifacts: - paths: - - public/ + - cd deploy + - sed -i s/IMAGE_TAG/$CI_COMMIT_REF_NAME@sha256:$(cat DIGESTFILE)/g + - cat deployment.yaml +# - for file in *; do kubectl apply -f $file; done diff --git a/deploy/deployment.yaml b/deploy/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..53688d5f2e86aeb6976b77c77b49e0635897180f --- /dev/null +++ b/deploy/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: teckids-website + namespace: teckids-website + labels: + app: teckids-website +spec: + replicas: 3 + selector: + matchLabels: + app: teckids-website + template: + metadata: + labels: + app: teckids-website + spec: + containers: + - name: caddy + image: registry.edugit.org/teckids/team-pr/teckids.org:IMAGE_TAG + ports: + - containerPort: 80 diff --git a/deploy/ingress.yaml b/deploy/ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9dd88ddd3cb65deb2a6a7d6c5325cc25155de031 --- /dev/null +++ b/deploy/ingress.yaml @@ -0,0 +1,37 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + cert-manager.io/cluster-issuer: letsencrypt-prod + kubernetes.io/tls-acme: "true" + name: teckids-website-caddy + namespace: teckids-website +spec: + ingressClassName: nginx + rules: + - host: teckids.org + http: + paths: + - backend: + service: + name: teckids-website + port: + number: 80 + path: / + pathType: Prefix + - host: www.teckids.org + http: + paths: + - backend: + service: + name: teckids-website + port: + number: 80 + path: / + pathType: Prefix + + tls: + - hosts: + - teckids.org + - www.teckids.org + secretName: teckids-website-tls diff --git a/deploy/service.yaml b/deploy/service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..64dbb905304b4676cedd690f8b978a7d3aa48e55 --- /dev/null +++ b/deploy/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: teckids-website + namespace: teckids-website +spec: + ports: + - name: http + port: 80 + protocol: TCP + targetPort: http + selector: + app: teckids-website + sessionAffinity: None + type: ClusterIP