When running my Docker image with `docker run -p 8...
# ktor
y
When running my Docker image with
docker run -p 8080:8080 kmp-rpc-server
, I encounter this critical error during startup:
Copy code
Exception in thread "main" java.lang.IllegalArgumentException: Neither port nor sslPort specified. Use command line options -port/-sslPort or configure connectors in application.conf
at io.ktor.server.engine.CommandLineKt.CommandLineConfig(CommandLine.kt:74)
at io.ktor.server.netty.EngineMain.createServer(EngineMain.kt:37)
at io.ktor.server.netty.EngineMain.main(EngineMain.kt:24)
at com.example.kmprpc.ApplicationKt.main(Application.kt:12)
Here's my Dockerfile:
Copy code
# Stage 1: Build the JAR
FROM gradle:latest AS build
COPY --chown=gradle:gradle . /home/gradle/app
WORKDIR /home/gradle/app
# Build and include resources
RUN gradle :server:buildFatJar

# Stage 2: Runtime Image
FROM amazoncorretto:22 AS runtime
EXPOSE 8080
RUN mkdir -p /app
COPY --from=build /home/gradle/app/server/build/libs/*.jar /app/app.jar
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
To see the project structure, check the image. and here is the repository link: https://github.com/yassineAbou/Kmp-Rpc
s
y
Thanks for the help