From 2d018f3688b1bb95870ed69da7c6ba0c0f616ee2 Mon Sep 17 00:00:00 2001 From: L1shed Date: Mon, 21 Oct 2024 10:53:10 +0200 Subject: [PATCH] Introduce Dockerfile --- .idea/misc.xml | 2 +- .idea/workspace.xml | 101 +++++++++++++++++++++++++++++----------- Dockerfile | 31 ++++++++++++ shared/build.gradle.kts | 1 + 4 files changed, 107 insertions(+), 28 deletions(-) create mode 100644 Dockerfile create mode 100644 shared/build.gradle.kts diff --git a/.idea/misc.xml b/.idea/misc.xml index d4cfd51..32cf4db 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 68ebc81..a0720a4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,24 +4,7 @@ - - - - - - - - - - - - - - - - - - + @@ -638,12 +685,6 @@ - - - - - - @@ -660,9 +701,15 @@ - - \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d616d36 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# Use the official Kotlin image +FROM openjdk:21-jdk-slim as build + +# Set the working directory +WORKDIR /server + +# Copy the build.gradle.kts and settings.gradle.kts +COPY build.gradle.kts settings.gradle.kts ./ + +# Copy the source code +COPY src ./src + +# Build the application +RUN ./gradlew build -x test + +# Second stage to create the final image +FROM openjdk:21-jre-slim + +# Set the working directory +WORKDIR /server + +# Copy the built JAR file from the previous stage +COPY --from=build /server/build/libs/*.jar server.jar + +# Expose the port your application runs on +EXPOSE 8080 + +ENV DISCORD_BOT_TOKEN="YOUr TOKEN" + +# Command to run the application +ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts new file mode 100644 index 0000000..5247b58 --- /dev/null +++ b/shared/build.gradle.kts @@ -0,0 +1 @@ +// empty, no build configuration needed for this module \ No newline at end of file