Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17-jdk-alpine
WORKDIR /app
COPY target/*.jar springboot-app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","springboot-app.jar"]
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
PGDATA: /data/postgres
POSTGRES_DB: jwt_security
volumes:
- postgres:/data/postgres
ports:
Expand All @@ -28,6 +29,23 @@ services:
networks:
- postgres
restart: unless-stopped
springboot:
networks:
- postgres
build:
dockerfile: Dockerfile
image: springboot:jwt
container_name: sb3jwt
environment:
- "SPRING_PROFILES_ACTIVE=docker"
restart: always
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_started
links:
- postgres

networks:
postgres:
Expand Down
23 changes: 23 additions & 0 deletions src/main/resources/application-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
spring:
datasource:
url: jdbc:postgresql://postgres-sql:5432/jwt_security
username: username
password: password
driver-class-name: org.postgresql.Driver
jpa:
hibernate:
ddl-auto: create-drop
show-sql: false
properties:
hibernate:
format_sql: true
database: postgresql
database-platform: org.hibernate.dialect.PostgreSQLDialect

application:
security:
jwt:
secret-key: 404E635266556A586E3272357538782F413F4428472B4B6250645367566B5970
expiration: 86400000 # a day
refresh-token:
expiration: 604800000 # 7 days
5 changes: 5 additions & 0 deletions start.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
call docker stop sb3jwt
call docker rm sb3jwt
call docker rmi springboot:jwt
call mvn clean package
call docker compose -f docker-compose.yml up --build -d
5 changes: 5 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docker stop sb3jwt
docker rm sb3jwt
docker rmi springboot:jwt
mvn clean package -DskipTests=true
docker compose -f docker-compose.yml up --build -d
1 change: 1 addition & 0 deletions stop.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
call docker compose -f docker-compose.yml down
1 change: 1 addition & 0 deletions stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker compose -f docker-compose.yml down