Skip to content

Commit bc68cc0

Browse files
committed
feat: add Dockerfile for JVM migration build and runtime stages
1 parent 37af8e4 commit bc68cc0

5 files changed

Lines changed: 75 additions & 28 deletions

File tree

.vscode/launch.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"projectName": "migration",
2020
"env": {
2121
"SPRING_DATASOURCE_URL": "jdbc:postgresql://localhost:5432/workastra_db?currentSchema=workastra",
22-
"SPRING_DATASOURCE_USERNAME": "workastra_user",
23-
"SPRING_DATASOURCE_PASSWORD": "workastra_password"
22+
"SPRING_DATASOURCE_USERNAME": "<user>",
23+
"SPRING_DATASOURCE_PASSWORD": "<password>"
2424
}
2525
},
2626
{
@@ -30,9 +30,9 @@
3030
"mainClass": "com.workastra.iam.IAMApplication",
3131
"projectName": "iam",
3232
"env": {
33-
"SPRING_DATASOURCE_URL": "jdbc:postgresql://localhost:5432/workastra_db?currentSchema=workastra",
34-
"SPRING_DATASOURCE_USERNAME": "workastra_user",
35-
"SPRING_DATASOURCE_PASSWORD": "workastra_password"
33+
"SPRING_DATASOURCE_URL": "jdbc:postgresql://localhost:5432/workastra?currentSchema=workastra",
34+
"SPRING_DATASOURCE_USERNAME": "<user>",
35+
"SPRING_DATASOURCE_PASSWORD": "<password>"
3636
}
3737
}
3838
]

iam/jvm.Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# syntax=docker/dockerfile:1.19.0
2+
3+
# Build stage
4+
FROM ghcr.io/graalvm/jdk-community:25.0.1 AS build
5+
6+
WORKDIR /app
7+
8+
# Copy build files first for better layer caching
9+
COPY gradlew gradlew.bat settings.gradle.kts build.gradle.kts ./
10+
COPY gradle/ gradle/
11+
12+
# Download Gradle distribution
13+
RUN --mount=type=cache,target=/root/.gradle \
14+
./gradlew --version
15+
16+
# Copy source and build
17+
COPY console/ console/
18+
COPY iam/ iam/
19+
COPY migration/ migration/
20+
21+
RUN --mount=type=cache,target=/root/.gradle \
22+
./gradlew --no-daemon iam:bootJar
23+
24+
# Runtime stage
25+
FROM eclipse-temurin:25-jre
26+
27+
WORKDIR /app
28+
29+
COPY --from=build /app/iam/build/libs/iam-*.jar iam.jar
30+
31+
USER 1000
32+
33+
EXPOSE 9000
34+
35+
CMD ["java", "-jar", "/app/iam.jar"]
Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
server:
33
port: 9000
4+
forward-headers-strategy: framework
45

56
spring:
67
main:
@@ -10,28 +11,6 @@ spring:
1011
name: user
1112
password: "{noop}password"
1213
roles: USER
13-
oauth2:
14-
authorizationserver:
15-
client:
16-
workastra-desk:
17-
registration:
18-
client-id: workastra-desk
19-
client-secret: "{noop}secret"
20-
client-authentication-methods:
21-
- client_secret_basic
22-
client-name: Workastra Desk
23-
authorization-grant-types:
24-
- authorization_code
25-
- refresh_token
26-
redirect-uris:
27-
- https://oauth.pstmn.io/v1/callback
28-
- http://localhost:3000/api/oidc/callback
29-
scopes:
30-
- openid
31-
- profile
32-
- offline_access
33-
require-authorization-consent: false
34-
require-proof-key: true
3514
jpa:
3615
hibernate:
3716
ddl-auto: none

migration/jvm.Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# syntax=docker/dockerfile:1.19.0
2+
3+
# Build stage
4+
FROM ghcr.io/graalvm/jdk-community:25.0.1 AS build
5+
6+
WORKDIR /app
7+
8+
# Copy build files first for better layer caching
9+
COPY gradlew gradlew.bat settings.gradle.kts build.gradle.kts ./
10+
COPY gradle/ gradle/
11+
12+
# Download Gradle distribution
13+
RUN --mount=type=cache,target=/root/.gradle \
14+
./gradlew --version
15+
16+
# Copy source and build
17+
COPY console/ console/
18+
COPY iam/ iam/
19+
COPY migration/ migration/
20+
21+
RUN --mount=type=cache,target=/root/.gradle \
22+
./gradlew --no-daemon migration:bootJar
23+
24+
# Runtime stage
25+
FROM eclipse-temurin:25-jre
26+
27+
WORKDIR /app
28+
29+
COPY --from=build /app/migration/build/libs/migration-*.jar app.jar
30+
31+
USER 1000
32+
33+
ENTRYPOINT ["java", "-jar", "/app/app.jar"]

migration/src/main/java/com/workastra/migration/Migration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void run(ApplicationArguments args) throws Exception {
3030
org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE
3131
)
3232
.authorizationGrantType(org.springframework.security.oauth2.core.AuthorizationGrantType.REFRESH_TOKEN)
33-
.redirectUri("http://localhost:3000/api/oidc/callback")
33+
.redirectUri("http://workastra.com/api/oidc/callback")
3434
.scope(org.springframework.security.oauth2.core.oidc.OidcScopes.OPENID)
3535
.scope(org.springframework.security.oauth2.core.oidc.OidcScopes.PROFILE)
3636
.scope("offline_access")

0 commit comments

Comments
 (0)