зеркало из https://github.com/Azure/draft-classic.git
Differentiate between gradle and maven projects for Java
This commit is contained in:
Родитель
f22271ba36
Коммит
d829dec3dc
|
@ -0,0 +1,10 @@
|
|||
FROM gradle:3.5-jdk8-alpine as BUILD
|
||||
|
||||
COPY . /project
|
||||
RUN gradle -b /project/build.gradle clean build
|
||||
|
||||
FROM openjdk:8-jdk-alpine
|
||||
EXPOSE 4567
|
||||
COPY --from=BUILD /project/target/app.jar /opt/app.jar
|
||||
WORKDIR /opt
|
||||
CMD ["java", "-jar", "app.jar"]
|
|
@ -0,0 +1 @@
|
|||
name: gradle
|
|
@ -0,0 +1,22 @@
|
|||
# Default values for Gradle projects.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
replicaCount: 2
|
||||
image:
|
||||
registry: docker.io
|
||||
org: library
|
||||
name: openjdk
|
||||
tag: 8-jdk-alpine
|
||||
pullPolicy: IfNotPresent
|
||||
service:
|
||||
name: java
|
||||
type: ClusterIP
|
||||
externalPort: 80
|
||||
internalPort: 4567
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
# bin/use <build-dir>
|
||||
|
||||
if [ -f $1/build.gradle ]; then
|
||||
echo "Gradle" && exit 0
|
||||
else
|
||||
echo "no" && exit 1
|
||||
fi
|
|
@ -1 +0,0 @@
|
|||
name: java
|
|
@ -0,0 +1,4 @@
|
|||
Dockerfile
|
||||
draft.toml
|
||||
chart/
|
||||
NOTICE
|
|
@ -0,0 +1,9 @@
|
|||
MIT License:
|
||||
|
||||
Copyright (C) 2011-2015 Heroku, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,21 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
|
@ -0,0 +1 @@
|
|||
name: maven
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
{{- if contains "NodePort" .Values.service.type }}
|
||||
Get the application URL by running these commands:
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT/login
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
Get the application URL by running these commands:
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
|
||||
{{- else }}
|
||||
http://{{ .Release.Name }}.{{ .Values.basedomain }} to access your application
|
||||
{{- end }}
|
|
@ -0,0 +1,16 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
*/}}
|
||||
{{- define "fullname" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,29 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.registry }}/{{ .Values.image.org }}/{{ .Values.image.name }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.service.internalPort }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: {{ .Values.service.internalPort }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: {{ .Values.service.internalPort }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
|
@ -0,0 +1,15 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
spec:
|
||||
rules:
|
||||
- host: {{ .Release.Name }}.{{ .Values.basedomain }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: {{ template "fullname" . }}
|
||||
servicePort: {{ .Values.service.externalPort }}
|
|
@ -0,0 +1,15 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.externalPort }}
|
||||
targetPort: {{ .Values.service.internalPort }}
|
||||
protocol: TCP
|
||||
name: {{ .Values.service.name }}
|
||||
selector:
|
||||
app: {{ template "fullname" . }}
|
|
@ -1,12 +1,12 @@
|
|||
# Default values for Java.
|
||||
# Default values for Maven projects.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
replicaCount: 2
|
||||
image:
|
||||
registry: docker.io
|
||||
org: library
|
||||
name: maven
|
||||
tag: onbuild
|
||||
name: openjdk
|
||||
tag: 8-jdk-alpine
|
||||
pullPolicy: IfNotPresent
|
||||
service:
|
||||
name: java
|
|
@ -2,7 +2,7 @@
|
|||
# bin/use <build-dir>
|
||||
|
||||
if [ -f $1/pom.xml ]; then
|
||||
echo "Java" && exit 0
|
||||
echo "Maven" && exit 0
|
||||
else
|
||||
echo "no" && exit 1
|
||||
fi
|
Загрузка…
Ссылка в новой задаче