Skip to content

Latest commit

 

History

History
53 lines (33 loc) · 1.66 KB

README.md

File metadata and controls

53 lines (33 loc) · 1.66 KB

Todo Web Application

This repo contains a todo web application written in kotlin.

The demo app is developed to provide samples to blog posts at http://ilkinulas.github.io/.

Build And Run

  1. ./gradlew clean shadowJar
  2. java -jar ./build/libs/kotlin-todo-app-1.0-SNAPSHOT-all.jar

By default application uses h2 (in memory) database. You can configure it to use mysql database with the -DDB_URL=.... program argument.

java \
 -DDB_URL="jdbc:mysql://127.0.0.1:3306/tododb"  \
 -jar ./build/libs/kotlin-todo-app-1.0-SNAPSHOT-all.jar`

Docker: Build, Run, Publish

To build a docker image run:

docker build -t ilkinulas/todoapp:1.0 .

You can start the container by running command below. This default setup will use the in memory database.

docker run -p 9000:9000 ilkinulas/todoapp:1.0

MySQL database usage is enabled by the environment variable DB_URL as seen below:

docker run \
 -p 9000:9000 \
 -e DB_URL="jdbc:mysql://172.23.0.1:3306/tododb" \
 ilkinulas/todoapp:1.0

To publish a docker image to docker repo you should use the docker push command. I have published the docker image of this demo project with the command below:

docker push ilkinulas/todoapp:1.0

Here is the docker hub url of the image repository: https://hub.docker.com/r/ilkinulas/todoapp/

docker-compose

Docker-compose file contains two images. mysql & todoapp. After running docker-compose up, mysql database and todo web app will be launched.

The application will be available at http://localhost:9000

docker-compose down command will stop the app and the database containers.