Skip to content
Snippets Groups Projects
Commit c7f81ca7 authored by Ali Dosmukhamedov's avatar Ali Dosmukhamedov :coffin:
Browse files

Version with docker compose

parent fa9c0a24
No related branches found
No related tags found
No related merge requests found
build/
.gradle/
.idea/
node_modules/
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
\ No newline at end of file
......@@ -4,5 +4,5 @@
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="openjdk-22" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="openjdk-22" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
FROM gradle:jdk11
# Set the working directory
WORKDIR /app
# Copy all files to the container
COPY . .
# Convert gradlew to Unix line endings and make it executable
RUN sed -i 's/\r$//' gradlew && chmod +x gradlew
# Build the app
RUN ./gradlew clean build --no-daemon
# Expose the application port
EXPOSE 8080
# Run the application with Kobweb
CMD ["./gradlew", "kobwebStart", "-t"]
version: '3.9'
services:
mongodbservice:
container_name: mongo_database
image: mongo:5.0
restart: always
ports:
- 27017:27017
volumes:
- mongo-data:/data/db
networks:
- todolist-network
todolistservice:
container_name: kobweb_backend
image: gradle:jdk11
build:
context: .
dockerfile: Dockerfile
ports:
- 8080:8080
environment:
MONGO_URL: mongodb://mongodbservice:27017
depends_on:
- mongodbservice
networks:
- todolist-network
volumes:
mongo-data:
networks:
todolist-network:
driver: bridge
\ No newline at end of file
kotlin.code.style=official
org.gradle.caching=true
org.gradle.configuration-cache=true
\ No newline at end of file
......@@ -20,6 +20,8 @@ repositories {
group = "todo"
version = "1.0-SNAPSHOT"
kotlin {
configAsKobwebApplication(includeServer = true)
......
......@@ -20,7 +20,7 @@ fun initializeMongo(context: InitApiContext) {
class MongoDbImp(): MongoDb {
private val client = MongoClient.create()
private val client = MongoClient.create(System.getenv("MONGO_URL"))
private val database = client.getDatabase("todolist")
private val tasksCollection = database.getCollection<Task>("tasks")
private val finishedTasksCollection = database.getCollection<Task>("finishedTasks")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment