diff --git a/previews/docker-console-1.png b/previews/docker-console-1.png new file mode 100644 index 0000000..90301c7 Binary files /dev/null and b/previews/docker-console-1.png differ diff --git a/previews/docker-console-2.png b/previews/docker-console-2.png new file mode 100644 index 0000000..96d908f Binary files /dev/null and b/previews/docker-console-2.png differ diff --git a/webrtc-backend/Dockerfile b/webrtc-backend/Dockerfile new file mode 100644 index 0000000..89b1659 --- /dev/null +++ b/webrtc-backend/Dockerfile @@ -0,0 +1,29 @@ +# Use the official Gradle 6.6.1 image with JDK 17 as the build environment +FROM gradle:6.6.1-jdk11 AS build + +# Set the working directory inside the container +WORKDIR /app + +# Copy the project files into the container +COPY . . + +# Set JVM compatibility to 17 in the build process +RUN gradle clean build -Dorg.gradle.java.home=/opt/java/openjdk -x test --no-daemon + +# Use the official OpenJDK 17 runtime as the runtime environment +FROM openjdk:17-jdk-slim + +# Set the working directory inside the container +WORKDIR /app + +# Copy the built JAR from the build environment +COPY --from=build /app/build/libs/*.jar app.jar + +# Expose the port that the application will run on +EXPOSE 8080 + +# Set environment variables if needed (e.g., for ports) +ENV PORT=8080 + +# Run the application +CMD ["java", "-jar", "app.jar"] diff --git a/webrtc-backend/build.gradle b/webrtc-backend/build.gradle index c639cdb..0a39ae7 100644 --- a/webrtc-backend/build.gradle +++ b/webrtc-backend/build.gradle @@ -41,3 +41,18 @@ dependencies { implementation "io.ktor:ktor-client-logging-jvm:$ktor_version" testImplementation "io.ktor:ktor-server-tests:$ktor_version" } + +// JAR task configuration to include the main class in the manifest +jar { + manifest { + attributes( + 'Main-Class': mainClassName, // Sets the Main-Class attribute for JAR execution + 'Implementation-Title': project.name, + 'Implementation-Version': project.version + ) + } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE // Exclude duplicate files + from { + configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } // Include dependencies in the JAR + } +} \ No newline at end of file diff --git a/webrtc-backend/docker-compose.yml b/webrtc-backend/docker-compose.yml new file mode 100644 index 0000000..0e883c0 --- /dev/null +++ b/webrtc-backend/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.8' + +services: + webrtc_ktro_server: +# image: DOCKER IMAGE NAME + build: . + ports: + - "8080:8080" + restart: always