Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
kimscott committed Jul 29, 2019
1 parent c06d48c commit c65c349
Show file tree
Hide file tree
Showing 14 changed files with 1,054 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/target/
/bin/
/.settings/
*#
*.iml
*.ipr
*.iws
*.jar
*.sw?
*~
.#*
.*.md.html
.DS_Store
.classpath
.factorypath
.gradle
.idea
.metadata
.project
.recommenders
.settings
.springBeans
/build
/code
MANIFEST.MF
_site/
activemq-data
bin
build
build.log
dependency-reduced-pom.xml
dump.rdb
interpolated*.xml
lib/
manifest.yml
overridedb.*
settings.xml
target
transaction-logs
.flattened-pom.xml
secrets.yml
.gradletasknamecache
.sts4-cache
node_modules
.dist/
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:8u212-jdk-alpine
COPY target/*SNAPSHOT.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java","-Xmx400M","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar","--spring.profiles.active=docker"]
88 changes: 88 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
steps:
### Test
# - id: 'test'
# name: 'gcr.io/cloud-builders/mvn'
# args: [
# 'test',
# '-Dspring.profiles.active=test'
# ]
### Build
- id: 'build'
name: 'gcr.io/cloud-builders/mvn'
args: [
'clean',
'package',
'-Dmaven.test.skip=true'
]
# waitFor: ['test']
### docker Build
- id: 'docker build'
name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '--tag=gcr.io/$PROJECT_ID/$_PROJECT_NAME:$COMMIT_SHA'
- '.'
### Publish
- id: 'publish'
name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
docker push gcr.io/$PROJECT_ID/$_PROJECT_NAME:$COMMIT_SHA
### deploy
- id: 'deploy'
name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
PROJECT=$$(gcloud config get-value core/project)
gcloud container clusters get-credentials "$${CLOUDSDK_CONTAINER_CLUSTER}" \
--project "$${PROJECT}" \
--zone "$${CLOUDSDK_COMPUTE_ZONE}"
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
name: $_PROJECT_NAME
labels:
app: $_PROJECT_NAME
spec:
ports:
- port: 8080
targetPort: 8080
selector:
app: $_PROJECT_NAME
EOF
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: $_PROJECT_NAME
labels:
app: $_PROJECT_NAME
spec:
replicas: 1
selector:
matchLabels:
app: $_PROJECT_NAME
template:
metadata:
labels:
app: $_PROJECT_NAME
spec:
containers:
- name: $_PROJECT_NAME
image: gcr.io/$PROJECT_ID/$_PROJECT_NAME:$COMMIT_SHA
ports:
- containerPort: 8080
EOF
options:
env:
# # location/name of GKE cluster (used by all kubectl commands)
- CLOUDSDK_COMPUTE_ZONE=asia-northeast1-a
- CLOUDSDK_CONTAINER_CLUSTER=uplus-poc-dev
Loading

0 comments on commit c65c349

Please sign in to comment.