Skip to content

Commit

Permalink
Generate API code + bootstrap webserver + simplify launch (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
michel-tricot authored Aug 5, 2020
1 parent 51920f2 commit 7491c94
Show file tree
Hide file tree
Showing 17 changed files with 954 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.gradle
.idea
build
.DS_Store
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ FROM gradle:jdk14 AS build

COPY . /code
WORKDIR /code
RUN gradle fatjar --no-daemon
RUN gradle distTar --no-daemon

# RUN
FROM openjdk:14.0.2-slim
EXPOSE 8080

RUN mkdir /app
WORKDIR /app/conduit-server

COPY --from=build /code/build/libs/*fatjar*.jar /app/conduit-application.jar
COPY --from=build /code/conduit-server/build/distributions/*.tar conduit-server.tar
RUN tar xvf conduit-server.tar --strip-components=1

ENTRYPOINT ["java", "-jar", "/app/conduit-application.jar"]
CMD bin/conduit-server
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# Conduit
## Getting Started

### Docker
Simply run
```
docker run --rm -it dataline/conduit:$VERSION
./tools/app/start.sh
```

### Repo
```
VERSION=$(cat .version)
docker build . -t dataline/conduit:$VERSION
docker run --rm -it dataline/conduit:$VERSION
```
And go to [http://localhost:8080]()
39 changes: 17 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
plugins {
id 'java'
allprojects {
group = "io.dataline.${rootProject.name}"
version = rootProject.file('.version').text.trim()
}

group 'io.dataline'
version = rootProject.file('.version').text.trim()
// For java projects (might need to add some filtering once we have the UI)
subprojects {
apply plugin: 'java'

repositories {
mavenCentral()
}

test {
useJUnitPlatform()
}
repositories {
mavenCentral()
}

dependencies {
compile group: 'com.google.guava', name: 'guava', version: '29.0-jre'
test {
useJUnitPlatform()
}

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
}
dependencies {
implementation group: 'com.google.guava', name: 'guava', version: '29.0-jre'

task fatjar(type: Jar) {
manifest {
attributes 'Main-Class': 'io.dataline.playground.HelloWorld'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.4.6'
}
baseName "${rootProject.name}-fatjar"
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
47 changes: 47 additions & 0 deletions conduit-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id "org.openapi.generator" version "4.3.1"
id "java-library"
}

def specFile = "$projectDir/src/main/openapi/conduit.yaml".toString()

openApiGenerate {
generatorName = "jaxrs-spec"
inputSpec = specFile
outputDir = "$buildDir/generated".toString()

apiPackage = "io.dataline.conduit.api"
invokerPackage = "io.dataline.conduit.api.invoker"
modelPackage = "io.dataline.conduit.api.model"

generateApiDocumentation = false

configOptions = [
dateLibrary : "java8",
generatePom : "false",
interfaceOnly: "true"
]
}

dependencies {
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.11.2'

implementation group: 'io.swagger', name: 'swagger-annotations', version: '1.6.2'

implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
implementation group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.1.1'
implementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
}

sourceSets {
main {
java {
srcDir "$buildDir/generated/src/gen/java"
}
resources {
srcDir "$projectDir/src/main/openapi/"
}
}
}

compileJava.dependsOn tasks.openApiGenerate
Loading

0 comments on commit 7491c94

Please sign in to comment.