-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c964400
Showing
17 changed files
with
770 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.gradle | ||
.kotlin | ||
build/ | ||
secrets/ | ||
|
||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM alpine | ||
# LABEL org.opencontainers.image.authors="[email protected]" | ||
RUN apk add openjdk17-jre | ||
|
||
# Define the user to use in this instance to prevent using root that even in a container, can be a security risk. | ||
ENV APPLICATION_USER=vapi_user | ||
|
||
# Then add the user, create the /app folder and give permissions to our user. | ||
RUN adduser --disabled-password --gecos '' $APPLICATION_USER | ||
RUN mkdir /app | ||
RUN chown -R $APPLICATION_USER /app | ||
|
||
# Mark this container to use the specified $APPLICATION_USER | ||
USER $APPLICATION_USER | ||
|
||
COPY ./build/libs/vapi4k-template.jar /app/vapi4k-template.jar | ||
COPY src/main/resources /app/src/main/resources | ||
|
||
# Make /app the working directory | ||
WORKDIR /app | ||
|
||
EXPOSE 8080 | ||
|
||
CMD [] | ||
# Launch java to execute the jar with defaults intended for containers. | ||
ENTRYPOINT ["java", "-server", "-XX:+UseContainerSupport", "-Xmx2048m", "-jar", "/app/vapi4k-template.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
VERSION=0.0.1 | ||
|
||
default: versioncheck | ||
|
||
clean: | ||
./gradlew clean | ||
|
||
compile: clean | ||
./gradlew build -x test | ||
|
||
jar: compile | ||
./gradlew buildFatJar | ||
|
||
run-jar: jar | ||
./gradlew runFatJar | ||
|
||
versioncheck: | ||
./gradlew dependencyUpdates | ||
|
||
# Assign your docker hub username here | ||
IMAGE_NAME := docker_hub_username/vapi4k-template | ||
PLATFORMS := linux/amd64,linux/arm64/v8 | ||
|
||
build-docker: jar | ||
docker build -t ${IMAGE_NAME}:${VERSION} . | ||
|
||
run-docker: | ||
docker run --rm -p 8080:8080 ${IMAGE_NAME}:${VERSION} | ||
|
||
push-docker: | ||
# prepare multiarch | ||
docker buildx use buildx 2>/dev/null || docker buildx create --use --name=buildx | ||
docker buildx build --platform ${PLATFORMS} --push -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${VERSION} . | ||
|
||
release: build-docker push-docker | ||
|
||
upgrade-wrapper: | ||
./gradlew wrapper --gradle-version=8.10.2 --distribution-type=bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: java -jar build/libs/vapi4k-template.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Vapi4k Application Template | ||
|
||
[](https://kotlinlang.org/) | ||
[](https://pinterest.github.io/ktlint/) | ||
|
||
This template is a starting point for creating a new [vapi.ai](https://vapi.ai) application using | ||
the vapi4k ktor plugin and Kotlin DSL. It contains some simple applications that can be deployed to | ||
Heroku or any docker-supported environment. | ||
|
||
For more information on how to use this template, please refer to the [vapi4k Documentation](https://docs.vapi4k.com/). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask | ||
|
||
val kotlin_version: String by project | ||
val logback_version: String by project | ||
val vapi4k_version: String by project | ||
|
||
plugins { | ||
val kotlinVersion: String by System.getProperties() | ||
val ktorVersion: String by System.getProperties() | ||
val versionsVersion: String by System.getProperties() | ||
|
||
java | ||
kotlin("jvm") version kotlinVersion | ||
id("io.ktor.plugin") version ktorVersion | ||
id("com.github.ben-manes.versions") version versionsVersion | ||
} | ||
|
||
group = "com.myapp" | ||
version = "1.0.0" | ||
|
||
application { | ||
mainClass.set("com.myapp.ApplicationKt") | ||
} | ||
|
||
ktor { | ||
fatJar { | ||
// Change this to whatever name you want | ||
// It also has to be changed in the Dockerfile | ||
archiveFileName.set("vapi4k-template.jar") | ||
} | ||
} | ||
|
||
// This must match the version defined in system.properties | ||
kotlin { | ||
jvmToolchain(11) | ||
} | ||
|
||
repositories { | ||
google() | ||
mavenCentral() | ||
maven(url = "https://jitpack.io") // Required for the vapi4k jars | ||
} | ||
|
||
dependencies { | ||
implementation("com.github.vapi4k.vapi4k:vapi4k-core:$vapi4k_version") | ||
implementation("com.github.vapi4k.vapi4k:vapi4k-dbms:$vapi4k_version") | ||
|
||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") | ||
} | ||
|
||
// Required for heroku deployments | ||
tasks.register("stage") { | ||
dependsOn("build", "clean") | ||
doLast { | ||
println("Stage task completed") | ||
} | ||
} | ||
|
||
// Required for heroku deployments | ||
tasks.named("build") { | ||
mustRunAfter("clean") | ||
} | ||
|
||
tasks.withType<DependencyUpdatesTask> { | ||
rejectVersionIf { | ||
listOf("BETA", "-RC").any { candidate.version.uppercase().contains(it) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
kotlin.code.style=official | ||
# Plugins | ||
systemProp.kotlinVersion=2.0.20 | ||
systemProp.ktorVersion=2.3.12 | ||
systemProp.versionsVersion=0.51.0 | ||
# Jars | ||
kotlin_version=2.0.20 | ||
vapi4k_version=1.3.16 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.