-
Install Java 17, go link for install SDKMAN
sdk install java x.y.z-vendor
-
Set it as your default JVM
export JAVA_HOME='$HOME/.sdkman/candidates/java/current'
-
Clone this repository:
git clone https://github.com/untalsanders/blog-api.git
-
Run application
# Dev Environment ./gradlew bootRun --args='--spring.profiles.active=dev --server.port=8080'
# Prod Environment ./gradlew bootRun --args='--spring.profiles.active=prod --server.port=8080'
To
production
you must provide as following variables environment, e.g.- DB_HOST=127.0.0.1
- DB_PORT=5432
- DB_USER=postgres
- DB_PASS=12345
- DB_NAME=my_db
Example:
# Prod Environment DB_HOST=localhost DB_PORT=5432 DB_USER=postgres DB_PASS=12345 DB_NAME=blog ./gradlew bootRun --args='--spring.profiles.active=prod --server.port=8080'
-
Build Image
# Build image docker build -t sandersgutierrez/blog-api:latest .
-
Run a container
# Create and run a container docker run -p 8080:8080 --name blog-app \ --env PORT=8080 \ --env DB_HOST=localhost \ --env DB_PORT=5432 \ --env DB_NAME=blog \ --env DB_USER=postgres \ --env DB_PASS=12345 \ sandersgutierrez/blog-api:latest
- Sanders Gutiérrez - System Engineer (Java Developer)
This project is software licensed under the BSL 1.0 license.