-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
- Loading branch information
Showing
18 changed files
with
902 additions
and
1 deletion.
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
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,61 @@ | ||
FROM openjdk:17-jdk-slim AS builder | ||
|
||
ENV GRADLE_VER=7.6.3 | ||
|
||
RUN apt-get update -qqy \ | ||
&& apt-get install -qqy \ | ||
--no-install-recommends \ | ||
curl \ | ||
ca-certificates \ | ||
unzip | ||
|
||
RUN mkdir -p /opt/ && cd /opt/ \ | ||
&& echo "Downloading gradle.." \ | ||
&& curl -sSfL "https://services.gradle.org/distributions/gradle-${GRADLE_VER}-bin.zip" -o gradle-$GRADLE_VER-bin.zip \ | ||
&& unzip gradle-$GRADLE_VER-bin.zip -d /opt/ \ | ||
&& rm gradle-$GRADLE_VER-bin.zip | ||
|
||
# Export some environment variables | ||
ENV GRADLE_HOME=/opt/gradle-$GRADLE_VER/ | ||
ENV PATH=$PATH:$GRADLE_HOME/bin | ||
|
||
RUN mkdir -p /home/app/libs | ||
|
||
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false" | ||
WORKDIR /home/app | ||
|
||
COPY . /home/app/ | ||
|
||
RUN gradle build --debug | ||
RUN find . | ||
|
||
FROM ghcr.io/openfaas/of-watchdog:0.10.6 AS watchdog | ||
|
||
FROM openjdk:17-slim AS ship | ||
RUN apt-get update -qqy \ | ||
&& apt-get install -qqy \ | ||
--no-install-recommends \ | ||
unzip | ||
RUN addgroup --system app \ | ||
&& adduser --system --ingroup app app | ||
|
||
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog | ||
RUN chmod +x /usr/bin/fwatchdog | ||
|
||
WORKDIR /home/app | ||
COPY --from=builder /home/app/function/build/distributions/function-1.0.zip ./function-1.0.zip | ||
USER app | ||
RUN unzip ./function-1.0.zip | ||
|
||
WORKDIR /home/app/ | ||
|
||
ENV upstream_url="http://127.0.0.1:8082" | ||
ENV mode="http" | ||
ENV CLASSPATH="/home/app/function-1.0/function-1.0.jar:/home/app/function-1.0/lib/*" | ||
|
||
ENV fprocess="java -XX:+UseContainerSupport com.openfaas.entrypoint.App" | ||
EXPOSE 8080 | ||
|
||
HEALTHCHECK --interval=5s CMD [ -e /tmp/.lock ] || exit 1 | ||
|
||
CMD ["fwatchdog"] |
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,24 @@ | ||
## Template: java24 | ||
|
||
The Java11 template uses gradle as a build system. | ||
|
||
Gradle version: 5.5.1 | ||
|
||
### Structure | ||
|
||
There are three projects which make up a single gradle build: | ||
|
||
- model - (Library) classes for parsing request/response | ||
- function - (Library) your function code as a developer, you will only ever see this folder | ||
- entrypoint - (App) HTTP server for re-using the JVM between requests | ||
|
||
### Handler | ||
|
||
The handler is written in the `./src/main/Handler.java` folder | ||
|
||
Tests are supported with junit via files in `./src/test` | ||
|
||
### External dependencies | ||
|
||
External dependencies can be specified in ./build.gradle in the normal way using jcenter, a local JAR or some other remote repository. | ||
|
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,17 @@ | ||
allprojects { | ||
repositories { | ||
jcenter() | ||
} | ||
} | ||
|
||
subprojects { | ||
version = '1.0' | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
|
||
flatDir { | ||
dirs 'libs' | ||
} | ||
} |
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,79 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'distribution' | ||
id 'maven-publish' | ||
} | ||
|
||
dependencies { | ||
api 'org.apache.commons:commons-math3:3.6.1' | ||
implementation 'com.google.guava:guava:23.0' | ||
testImplementation 'junit:junit:4.12' | ||
implementation 'com.openfaas:model:0.1.1' | ||
implementation 'com.openfaas:entrypoint:0.1.0' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
|
||
flatDir { | ||
dirs '../libs' | ||
} | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes 'Implementation-Title': 'OpenFaaS Function', | ||
'Implementation-Version': '1.0' | ||
} | ||
} | ||
|
||
distributions { | ||
main { | ||
contents { | ||
from jar | ||
into('lib') { | ||
from(project.configurations.runtimeClasspath) | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Configure publishing with the maven-publish plugin | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact jar | ||
|
||
pom { | ||
name.set('OpenFaaS Function') | ||
description.set('An OpenFaaS function implementation.') | ||
url.set('https://www.openfaas.com/') | ||
licenses { | ||
license { | ||
name.set('MIT') | ||
url.set('https://opensource.org/licenses/MIT') | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set('openfaas') | ||
name.set('OpenFaaS Ltd') | ||
email.set('info@openfaas.com') | ||
} | ||
} | ||
scm { | ||
connection.set('scm:git:https://github.com/openfaas/templates.git') | ||
developerConnection.set('scm:git:https://github.com/openfaas/templates.git') | ||
url.set('https://github.com/openfaas/templates') | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
flatDir { | ||
dirs 'repos' | ||
} | ||
} | ||
} |
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
template/java17/function/gradle/wrapper/gradle-wrapper.properties
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,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.