forked from stakater-lab/stakater-nordmart-review-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTiltfile
60 lines (50 loc) · 2.8 KB
/
Tiltfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# VERY IMPORTANT NOTES:
# 1. This Tiltfile is for a Java project and same Tiltfile can't be used for all sorts of application; some tweaks are required - this Tiltfile is being used for this Java based application: https://github.com/stakater-lab/stakater-nordmart-review
# 2. The Dockerfile must have a specific structure for this Tiltfile to work - for reference look this Dockerfile
# For more on Extensions, see: https://docs.tilt.dev/extensions.html
load('ext://restart_process', 'docker_build_with_restart')
settings = read_json('tilt_options.json', default={})
if settings.get("namespace"):
namespace = settings.get("namespace")
if settings.get("default_registry"):
default_registry(settings.get("default_registry").format(namespace), host_from_cluster='image-registry.openshift-image-registry.svc:5000/{}'.format(namespace))
if settings.get("allow_k8s_contexts"):
allow_k8s_contexts(settings.get("allow_k8s_contexts"))
# Watch source code and on change rebuild artifacts and place in target folder
local_resource(
'review-compile',
'mvn package && ' +
########################################################################################
# TODO: Update this to match what your pom file produces application-v1-2.0-SNAPSHOT.jar
########################################################################################
'java -Djarmode=layertools -jar target/review-v0.0.0-SNAPSHOT.jar extract --destination target/jar-extracted && ' +
'rsync --delete --inplace --checksum -r target/jar-extracted/ target/jar',
deps=['src', 'pom.xml'])
# Keeps the docker image updated
docker_build_with_restart(
#############################################
# TODO: Should match following
# application.applicationName and
# application.deployment.image.repository
#############################################
'review',
'./target/jar',
entrypoint=['java', 'org.springframework.boot.loader.JarLauncher'],
platform='linux/amd64',
#########################################################
# NOTE: Remember Dockerfile must have a particular format
#########################################################
dockerfile='./DockerfileTilt',
live_update=[
sync('./target/jar/application', '/app'),
sync('./target/jar/dependencies', '/app'),
sync('./target/jar/snapshot-dependencies', '/app'),
sync('./target/jar/spring-boot-loader', '/app'),
])
yaml = helm('./deploy/', namespace=namespace, values=['./tilt/values-local.yaml'])
k8s_yaml(yaml)
#######################################################################
# NOTE: These are application dependent; so, you will need to update it
#######################################################################
k8s_resource('review-mongodb', port_forwards=['27017:27017'])
k8s_resource('review', port_forwards=['9000:8080'], resource_deps=['review-compile'])