add Dockerfile & chart directory

This commit is contained in:
choni824 2022-12-28 18:01:03 +09:00
parent e8e37b35c3
commit 010b325692
6 changed files with 134 additions and 0 deletions

20
Dockerfile Normal file
View file

@ -0,0 +1,20 @@
# Dockerfile
FROM docker.io/library/gradle:7.5.1-jdk11 AS build
WORKDIR /app
# add project
ADD . /app/
RUN gradle clean bootJar
FROM docker.io/library/eclipse-temurin:11-jre-focal AS app
WORKDIR /app
COPY --from=build /app/build/libs/spring-petclinic-2.7.3.jar .
EXPOSE 8080
# server run
ENTRYPOINT ["java"]
CMD ["-jar", "/app/spring-petclinic-2.7.3.jar"]

23
chart/.helmignore Normal file
View file

@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

24
chart/Chart.yaml Normal file
View file

@ -0,0 +1,24 @@
apiVersion: v2
name: chart
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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: "1.16.0"

View file

@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.app.name }}
labels:
app: {{ .Values.app.name }}
spec:
replicas: {{ .Values.app.replicaCount }}
selector:
matchLabels:
app: {{ .Values.app.name }}
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
template:
metadata:
labels:
app: {{ .Values.app.name }}
spec:
{{- with .Values.app.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: app
imagePullPolicy: Always
image: {{ .Values.app.image }}
{{- with .Values.app.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
command: [ "java" ]
args:
- "-jar"
- "spring-petclinic-2.7.3.jar"
{{- with .Values.app.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- containerPort: 8080

View file

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: {{ .Values.app.name }}
name: {{ .Values.app.name }}-svc
spec:
ports:
- name: petclinic
port: 80
protocol: TCP
targetPort: 8080
selector:
app: {{ .Values.app.name }}
type: {{ .Values.app.service.type }}

9
chart/values.yaml Normal file
View file

@ -0,0 +1,9 @@
app:
name: petclinic-k8s
profile:
replicaCount: 1
hostAliases: []
image: doubles.kr-central-1.kcr.dev/bella-test/test-img:latest
resources: {}
service:
type: LoadBalancer