diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97b3ce8..ea9f290 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,4 +41,14 @@ deploy: - scp -r -v -o StrictHostKeyChecking=no ./target/json-schema-store-*.jar tc_spo01@wp-p1m2-3d:~/deployments/sw/www/json-schema-store/json-schema-store.jar - ssh -v -o StrictHostKeyChecking=no tc_spo01@wp-p1m2-3d "~/config/start.sh" # only: -# - master \ No newline at end of file +# - master + +deploy-dev-json-schema-store-k8: + image: dtzar/helm-kubectl + stage: deploy + script: + - sed -i s#%DOCKER_IMAGE%#$CI_REGISTRY_IMAGE\:$CI_COMMIT_SHA#g Kubernetes-dev-deployment.yaml + - kubectl delete secret gitlab --namespace=bsd-dev + - kubectl create secret docker-registry gitlab --docker-server=$CI_REGISTRY --docker-username=$DOCKER_USER --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL --namespace=bsd-dev + - kubectl apply -f Kubernetes-dev-deployment.yaml --namespace=bsd-dev + when: manual diff --git a/Dockerfile b/Dockerfile index e759232..cbe2c2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ FROM openjdk:11-jre ARG JAR_FILE=target/*.jar COPY ${JAR_FILE} json-schema-store.jar -ENTRYPOINT ["java","-jar","/json-schema-store.jar", "--spring.profiles.active=docker"] \ No newline at end of file +ENTRYPOINT ["java","-jar","/json-schema-store.jar"] diff --git a/Kubernetes-dev-deployment.yaml b/Kubernetes-dev-deployment.yaml new file mode 100644 index 0000000..fa39871 --- /dev/null +++ b/Kubernetes-dev-deployment.yaml @@ -0,0 +1,44 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: json-schema-store +spec: + replicas: 2 + selector: + matchLabels: + app: json-schema-store + template: + metadata: + labels: + app: json-schema-store + spec: + containers: + - name: json-schema-store + image: %DOCKER_IMAGE% + imagePullPolicy: IfNotPresent + args: ["--spring.profiles.active=docker"] + ports: + - containerPort: 8110 + livenessProbe: + httpGet: + path: + port: 8110 + initialDelaySeconds: 100 + timeoutSeconds: 15 + periodSeconds: 10 + failureThreshold: 2 + imagePullSecrets: + - name: gitlab +--- +apiVersion: v1 +kind: Service +metadata: + name: json-schema-store +spec: + ports: + - port: 8110 + targetPort: 8110 + selector: + app: json-schema-store + type: NodePort + externalTrafficPolicy: Local