Skip to content

Instantly share code, notes, and snippets.

@bagf
Last active September 2, 2019 15:11
Show Gist options
  • Save bagf/a659e5b9723b7a5743eedcdb67f31790 to your computer and use it in GitHub Desktop.
Save bagf/a659e5b9723b7a5743eedcdb67f31790 to your computer and use it in GitHub Desktop.
SBT (lagom framework) deployment
#!/usr/bin/env bash
images=$(echo $IMAGES | tr " " "\n")
for image in $images
do
IFS=':' read -ra imageSplit <<< "$image"
IMGNAME=${imageSplit[0]}
IMGTAG=${imageSplit[1]}
PROJECT="$(basename $IMGNAME)"
if [ "$PUSH_IMAGE" == "true" ]
then
sbt "set version in ThisBuild := \"$IMGTAG\"" "project $PROJECT" "docker:publish"
# Have to tag latest or my deployment will error when pulling the image
docker tag "$IMGNAME:$IMGTAG" "$IMGNAME:latest"
docker push "$IMGNAME:latest"
else
sbt "set version in ThisBuild := \"$IMGTAG\"" "project $PROJECT" "docker:publishLocal"
fi
done
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: lagom-test-service
labels:
appName: lagom-test-service
namespace: test
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
appName: lagom-test-service
template:
metadata:
labels:
appName: lagom-test-service
spec:
restartPolicy: Always
containers:
- readinessProbe:
httpGet:
path: /ready
port: management
livenessProbe:
httpGet:
path: /alive
port: management
name: lagom-test-service
image: gcr.io/project/lagom-test-service-impl
ports:
- containerPort: 10000
name: http
- containerPort: 2552
name: remoting
- containerPort: 8558
name: management
imagePullPolicy: Always
volumeMounts: []
env:
- name: "APPLICATION_SECRET"
valueFrom:
secretKeyRef:
name: "secrets"
key: "application_secret"
envFrom:
- configMapRef:
name: "settings-env"
volumes: []
apiVersion: skaffold/v1beta13
kind: Config
profiles:
- name: lagom-test-service-impl
build:
artifacts:
- image: gcr.io/project/lagom-test-service-impl
custom:
buildCommand: ./scripts/build.sh
dependencies:
paths:
- ./lagom-test-service-api
- ./lagom-test-service-impl
deploy:
kubectl:
manifests:
- k8s/lagom-test-service/*.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment