kybernus 2.0.7 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kybernus",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "type": "module",
5
5
  "description": "The Ultimate Scaffolding CLI for Modern Developers",
6
6
  "main": "dist/index.js",
@@ -3,86 +3,78 @@ name: CI/CD Pipeline
3
3
  on:
4
4
  push:
5
5
  branches: [main, develop]
6
- pull_request:
7
- branches: [main]
8
-
9
- env:
10
- NODE_VERSION: '20'
11
- AWS_REGION: 'us-east-1'
12
-
13
- jobs:
14
- test:
15
- runs-on: ubuntu-latest
16
-
17
- steps:
18
- - uses: actions/checkout@v4
19
-
20
- - name: Setup Node.js
21
- uses: actions/setup-node@v4
22
- with:
23
- node-version: $\{{ env.NODE_VERSION }}
24
- cache: 'npm'
25
-
26
- - name: Install dependencies
27
- run: npm ci
28
-
29
- - name: Run linter
30
- run: npm run lint --if-present
31
-
32
- - name: Run tests
33
- run: npm test --if-present
34
-
35
- - name: Build
36
- run: npm run build
37
-
38
- build-and-push:
39
- needs: test
40
- runs-on: ubuntu-latest
41
- if: github.ref == 'refs/heads/main'
42
-
43
- steps:
44
- - uses: actions/checkout@v4
45
-
46
- - name: Configure AWS credentials
47
- uses: aws-actions/configure-aws-credentials@v4
48
- with:
49
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
50
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
51
- aws-region: $\{{ env.AWS_REGION }}
52
-
53
- - name: Login to Amazon ECR
54
- id: login-ecr
55
- uses: aws-actions/amazon-ecr-login@v2
56
-
57
- - name: Build, tag, and push image to Amazon ECR
58
- env:
59
- ECR_REGISTRY: $\{{ steps.login-ecr.outputs.registry }}
60
- ECR_REPOSITORY: {{projectNameKebabCase}}
61
- IMAGE_TAG: $\{{ github.sha }}
62
- run: |
63
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
64
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
65
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
66
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
67
-
68
- deploy:
69
- needs: build-and-push
70
- runs-on: ubuntu-latest
71
- if: github.ref == 'refs/heads/main'
72
-
73
- steps:
74
- - uses: actions/checkout@v4
75
-
76
- - name: Configure AWS credentials
77
- uses: aws-actions/configure-aws-credentials@v4
78
- with:
79
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
80
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
81
- aws-region: $\{{ env.AWS_REGION }}
82
-
83
- - name: Deploy to ECS
84
- run: |
85
- aws ecs update-service \
86
- --cluster {{projectNameKebabCase}}-prod \
87
- --service {{projectNameKebabCase}}-api \
88
- --force-new-deployment
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ JAVA_VERSION: '21'
11
+ AWS_REGION: 'us-east-1'
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Setup Java
21
+ uses: actions/setup-java@v4
22
+ with:
23
+ distribution: 'temurin'
24
+ java-version: ${{ env.JAVA_VERSION }}
25
+ cache: 'maven'
26
+
27
+ - name: Build with Maven
28
+ run: mvn clean verify
29
+
30
+ build-and-push:
31
+ needs: test
32
+ runs-on: ubuntu-latest
33
+ if: github.ref == 'refs/heads/main'
34
+
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+
38
+ - name: Configure AWS credentials
39
+ uses: aws-actions/configure-aws-credentials@v4
40
+ with:
41
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
42
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
43
+ aws-region: ${{ env.AWS_REGION }}
44
+
45
+ - name: Login to Amazon ECR
46
+ id: login-ecr
47
+ uses: aws-actions/amazon-ecr-login@v2
48
+
49
+ - name: Build, tag, and push image to Amazon ECR
50
+ env:
51
+ ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
52
+ ECR_REPOSITORY: {{projectNameKebabCase}}
53
+ IMAGE_TAG: ${{ github.sha }}
54
+ run: |
55
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
56
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
57
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
58
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
59
+
60
+ deploy:
61
+ needs: build-and-push
62
+ runs-on: ubuntu-latest
63
+ if: github.ref == 'refs/heads/main'
64
+
65
+ steps:
66
+ - uses: actions/checkout@v4
67
+
68
+ - name: Configure AWS credentials
69
+ uses: aws-actions/configure-aws-credentials@v4
70
+ with:
71
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
72
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
73
+ aws-region: ${{ env.AWS_REGION }}
74
+
75
+ - name: Deploy to ECS
76
+ run: |
77
+ aws ecs update-service \
78
+ --cluster {{projectNameKebabCase}}-prod \
79
+ --service {{projectNameKebabCase}}-api \
80
+ --force-new-deployment
@@ -1,45 +1,41 @@
1
1
  # Production Dockerfile for {{projectName}}
2
2
 
3
3
  # Build stage
4
- FROM node:20-alpine AS builder
4
+ FROM maven:3.9-eclipse-temurin-21-alpine AS builder
5
5
 
6
6
  WORKDIR /app
7
7
 
8
- # Copy package files
9
- COPY package*.json ./
10
-
11
- # Install dependencies
12
- RUN npm ci --only=production
8
+ # Copy pom.xml and install dependencies
9
+ COPY pom.xml .
10
+ RUN mvn dependency:go-offline
13
11
 
14
12
  # Copy source code
15
- COPY . .
13
+ COPY src ./src
16
14
 
17
- # Build TypeScript
18
- RUN npm run build
15
+ # Build application
16
+ RUN mvn package -DskipTests
19
17
 
20
18
  # Production stage
21
- FROM node:20-alpine AS production
19
+ FROM eclipse-temurin:21-jre-alpine AS production
22
20
 
23
21
  WORKDIR /app
24
22
 
25
23
  # Create non-root user
26
- RUN addgroup -g 1001 -S nodejs && \
27
- adduser -S nodejs -u 1001
24
+ RUN addgroup -g 1001 -S spring && \
25
+ adduser -S spring -u 1001
28
26
 
29
27
  # Copy built application
30
- COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
31
- COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
32
- COPY --from=builder --chown=nodejs:nodejs /app/package.json ./
28
+ COPY --from=builder --chown=spring:spring /app/target/*.jar app.jar
33
29
 
34
30
  # Switch to non-root user
35
- USER nodejs
31
+ USER spring
36
32
 
37
33
  # Expose port
38
- EXPOSE 3000
34
+ EXPOSE 8080
39
35
 
40
36
  # Health check
41
37
  HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
42
- CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
38
+ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/actuator/health || exit 1
43
39
 
44
40
  # Start application
45
- CMD ["node", "dist/index.js"]
41
+ CMD ["java", "-jar", "app.jar"]
@@ -3,86 +3,78 @@ name: CI/CD Pipeline
3
3
  on:
4
4
  push:
5
5
  branches: [main, develop]
6
- pull_request:
7
- branches: [main]
8
-
9
- env:
10
- NODE_VERSION: '20'
11
- AWS_REGION: 'us-east-1'
12
-
13
- jobs:
14
- test:
15
- runs-on: ubuntu-latest
16
-
17
- steps:
18
- - uses: actions/checkout@v4
19
-
20
- - name: Setup Node.js
21
- uses: actions/setup-node@v4
22
- with:
23
- node-version: $\{{ env.NODE_VERSION }}
24
- cache: 'npm'
25
-
26
- - name: Install dependencies
27
- run: npm ci
28
-
29
- - name: Run linter
30
- run: npm run lint --if-present
31
-
32
- - name: Run tests
33
- run: npm test --if-present
34
-
35
- - name: Build
36
- run: npm run build
37
-
38
- build-and-push:
39
- needs: test
40
- runs-on: ubuntu-latest
41
- if: github.ref == 'refs/heads/main'
42
-
43
- steps:
44
- - uses: actions/checkout@v4
45
-
46
- - name: Configure AWS credentials
47
- uses: aws-actions/configure-aws-credentials@v4
48
- with:
49
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
50
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
51
- aws-region: $\{{ env.AWS_REGION }}
52
-
53
- - name: Login to Amazon ECR
54
- id: login-ecr
55
- uses: aws-actions/amazon-ecr-login@v2
56
-
57
- - name: Build, tag, and push image to Amazon ECR
58
- env:
59
- ECR_REGISTRY: $\{{ steps.login-ecr.outputs.registry }}
60
- ECR_REPOSITORY: {{projectNameKebabCase}}
61
- IMAGE_TAG: $\{{ github.sha }}
62
- run: |
63
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
64
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
65
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
66
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
67
-
68
- deploy:
69
- needs: build-and-push
70
- runs-on: ubuntu-latest
71
- if: github.ref == 'refs/heads/main'
72
-
73
- steps:
74
- - uses: actions/checkout@v4
75
-
76
- - name: Configure AWS credentials
77
- uses: aws-actions/configure-aws-credentials@v4
78
- with:
79
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
80
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
81
- aws-region: $\{{ env.AWS_REGION }}
82
-
83
- - name: Deploy to ECS
84
- run: |
85
- aws ecs update-service \
86
- --cluster {{projectNameKebabCase}}-prod \
87
- --service {{projectNameKebabCase}}-api \
88
- --force-new-deployment
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ JAVA_VERSION: '21'
11
+ AWS_REGION: 'us-east-1'
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Setup Java
21
+ uses: actions/setup-java@v4
22
+ with:
23
+ distribution: 'temurin'
24
+ java-version: ${{ env.JAVA_VERSION }}
25
+ cache: 'maven'
26
+
27
+ - name: Build with Maven
28
+ run: mvn clean verify
29
+
30
+ build-and-push:
31
+ needs: test
32
+ runs-on: ubuntu-latest
33
+ if: github.ref == 'refs/heads/main'
34
+
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+
38
+ - name: Configure AWS credentials
39
+ uses: aws-actions/configure-aws-credentials@v4
40
+ with:
41
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
42
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
43
+ aws-region: ${{ env.AWS_REGION }}
44
+
45
+ - name: Login to Amazon ECR
46
+ id: login-ecr
47
+ uses: aws-actions/amazon-ecr-login@v2
48
+
49
+ - name: Build, tag, and push image to Amazon ECR
50
+ env:
51
+ ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
52
+ ECR_REPOSITORY: {{projectNameKebabCase}}
53
+ IMAGE_TAG: ${{ github.sha }}
54
+ run: |
55
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
56
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
57
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
58
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
59
+
60
+ deploy:
61
+ needs: build-and-push
62
+ runs-on: ubuntu-latest
63
+ if: github.ref == 'refs/heads/main'
64
+
65
+ steps:
66
+ - uses: actions/checkout@v4
67
+
68
+ - name: Configure AWS credentials
69
+ uses: aws-actions/configure-aws-credentials@v4
70
+ with:
71
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
72
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
73
+ aws-region: ${{ env.AWS_REGION }}
74
+
75
+ - name: Deploy to ECS
76
+ run: |
77
+ aws ecs update-service \
78
+ --cluster {{projectNameKebabCase}}-prod \
79
+ --service {{projectNameKebabCase}}-api \
80
+ --force-new-deployment
@@ -1,45 +1,41 @@
1
1
  # Production Dockerfile for {{projectName}}
2
2
 
3
3
  # Build stage
4
- FROM node:20-alpine AS builder
4
+ FROM maven:3.9-eclipse-temurin-21-alpine AS builder
5
5
 
6
6
  WORKDIR /app
7
7
 
8
- # Copy package files
9
- COPY package*.json ./
10
-
11
- # Install dependencies
12
- RUN npm ci --only=production
8
+ # Copy pom.xml and install dependencies
9
+ COPY pom.xml .
10
+ RUN mvn dependency:go-offline
13
11
 
14
12
  # Copy source code
15
- COPY . .
13
+ COPY src ./src
16
14
 
17
- # Build TypeScript
18
- RUN npm run build
15
+ # Build application
16
+ RUN mvn package -DskipTests
19
17
 
20
18
  # Production stage
21
- FROM node:20-alpine AS production
19
+ FROM eclipse-temurin:21-jre-alpine AS production
22
20
 
23
21
  WORKDIR /app
24
22
 
25
23
  # Create non-root user
26
- RUN addgroup -g 1001 -S nodejs && \
27
- adduser -S nodejs -u 1001
24
+ RUN addgroup -g 1001 -S spring && \
25
+ adduser -S spring -u 1001
28
26
 
29
27
  # Copy built application
30
- COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
31
- COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
32
- COPY --from=builder --chown=nodejs:nodejs /app/package.json ./
28
+ COPY --from=builder --chown=spring:spring /app/target/*.jar app.jar
33
29
 
34
30
  # Switch to non-root user
35
- USER nodejs
31
+ USER spring
36
32
 
37
33
  # Expose port
38
- EXPOSE 3000
34
+ EXPOSE 8080
39
35
 
40
36
  # Health check
41
37
  HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
42
- CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
38
+ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/actuator/health || exit 1
43
39
 
44
40
  # Start application
45
- CMD ["node", "dist/index.js"]
41
+ CMD ["java", "-jar", "app.jar"]
@@ -3,86 +3,78 @@ name: CI/CD Pipeline
3
3
  on:
4
4
  push:
5
5
  branches: [main, develop]
6
- pull_request:
7
- branches: [main]
8
-
9
- env:
10
- NODE_VERSION: '20'
11
- AWS_REGION: 'us-east-1'
12
-
13
- jobs:
14
- test:
15
- runs-on: ubuntu-latest
16
-
17
- steps:
18
- - uses: actions/checkout@v4
19
-
20
- - name: Setup Node.js
21
- uses: actions/setup-node@v4
22
- with:
23
- node-version: $\{{ env.NODE_VERSION }}
24
- cache: 'npm'
25
-
26
- - name: Install dependencies
27
- run: npm ci
28
-
29
- - name: Run linter
30
- run: npm run lint --if-present
31
-
32
- - name: Run tests
33
- run: npm test --if-present
34
-
35
- - name: Build
36
- run: npm run build
37
-
38
- build-and-push:
39
- needs: test
40
- runs-on: ubuntu-latest
41
- if: github.ref == 'refs/heads/main'
42
-
43
- steps:
44
- - uses: actions/checkout@v4
45
-
46
- - name: Configure AWS credentials
47
- uses: aws-actions/configure-aws-credentials@v4
48
- with:
49
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
50
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
51
- aws-region: $\{{ env.AWS_REGION }}
52
-
53
- - name: Login to Amazon ECR
54
- id: login-ecr
55
- uses: aws-actions/amazon-ecr-login@v2
56
-
57
- - name: Build, tag, and push image to Amazon ECR
58
- env:
59
- ECR_REGISTRY: $\{{ steps.login-ecr.outputs.registry }}
60
- ECR_REPOSITORY: {{projectNameKebabCase}}
61
- IMAGE_TAG: $\{{ github.sha }}
62
- run: |
63
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
64
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
65
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
66
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
67
-
68
- deploy:
69
- needs: build-and-push
70
- runs-on: ubuntu-latest
71
- if: github.ref == 'refs/heads/main'
72
-
73
- steps:
74
- - uses: actions/checkout@v4
75
-
76
- - name: Configure AWS credentials
77
- uses: aws-actions/configure-aws-credentials@v4
78
- with:
79
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
80
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
81
- aws-region: $\{{ env.AWS_REGION }}
82
-
83
- - name: Deploy to ECS
84
- run: |
85
- aws ecs update-service \
86
- --cluster {{projectNameKebabCase}}-prod \
87
- --service {{projectNameKebabCase}}-api \
88
- --force-new-deployment
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ JAVA_VERSION: '21'
11
+ AWS_REGION: 'us-east-1'
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Setup Java
21
+ uses: actions/setup-java@v4
22
+ with:
23
+ distribution: 'temurin'
24
+ java-version: ${{ env.JAVA_VERSION }}
25
+ cache: 'maven'
26
+
27
+ - name: Build with Maven
28
+ run: mvn clean verify
29
+
30
+ build-and-push:
31
+ needs: test
32
+ runs-on: ubuntu-latest
33
+ if: github.ref == 'refs/heads/main'
34
+
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+
38
+ - name: Configure AWS credentials
39
+ uses: aws-actions/configure-aws-credentials@v4
40
+ with:
41
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
42
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
43
+ aws-region: ${{ env.AWS_REGION }}
44
+
45
+ - name: Login to Amazon ECR
46
+ id: login-ecr
47
+ uses: aws-actions/amazon-ecr-login@v2
48
+
49
+ - name: Build, tag, and push image to Amazon ECR
50
+ env:
51
+ ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
52
+ ECR_REPOSITORY: {{projectNameKebabCase}}
53
+ IMAGE_TAG: ${{ github.sha }}
54
+ run: |
55
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
56
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
57
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
58
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
59
+
60
+ deploy:
61
+ needs: build-and-push
62
+ runs-on: ubuntu-latest
63
+ if: github.ref == 'refs/heads/main'
64
+
65
+ steps:
66
+ - uses: actions/checkout@v4
67
+
68
+ - name: Configure AWS credentials
69
+ uses: aws-actions/configure-aws-credentials@v4
70
+ with:
71
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
72
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
73
+ aws-region: ${{ env.AWS_REGION }}
74
+
75
+ - name: Deploy to ECS
76
+ run: |
77
+ aws ecs update-service \
78
+ --cluster {{projectNameKebabCase}}-prod \
79
+ --service {{projectNameKebabCase}}-api \
80
+ --force-new-deployment
@@ -1,45 +1,41 @@
1
1
  # Production Dockerfile for {{projectName}}
2
2
 
3
3
  # Build stage
4
- FROM node:20-alpine AS builder
4
+ FROM maven:3.9-eclipse-temurin-21-alpine AS builder
5
5
 
6
6
  WORKDIR /app
7
7
 
8
- # Copy package files
9
- COPY package*.json ./
10
-
11
- # Install dependencies
12
- RUN npm ci --only=production
8
+ # Copy pom.xml and install dependencies
9
+ COPY pom.xml .
10
+ RUN mvn dependency:go-offline
13
11
 
14
12
  # Copy source code
15
- COPY . .
13
+ COPY src ./src
16
14
 
17
- # Build TypeScript
18
- RUN npm run build
15
+ # Build application
16
+ RUN mvn package -DskipTests
19
17
 
20
18
  # Production stage
21
- FROM node:20-alpine AS production
19
+ FROM eclipse-temurin:21-jre-alpine AS production
22
20
 
23
21
  WORKDIR /app
24
22
 
25
23
  # Create non-root user
26
- RUN addgroup -g 1001 -S nodejs && \
27
- adduser -S nodejs -u 1001
24
+ RUN addgroup -g 1001 -S spring && \
25
+ adduser -S spring -u 1001
28
26
 
29
27
  # Copy built application
30
- COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
31
- COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
32
- COPY --from=builder --chown=nodejs:nodejs /app/package.json ./
28
+ COPY --from=builder --chown=spring:spring /app/target/*.jar app.jar
33
29
 
34
30
  # Switch to non-root user
35
- USER nodejs
31
+ USER spring
36
32
 
37
33
  # Expose port
38
- EXPOSE 3000
34
+ EXPOSE 8080
39
35
 
40
36
  # Health check
41
37
  HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
42
- CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
38
+ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/actuator/health || exit 1
43
39
 
44
40
  # Start application
45
- CMD ["node", "dist/index.js"]
41
+ CMD ["java", "-jar", "app.jar"]
@@ -3,86 +3,80 @@ name: CI/CD Pipeline
3
3
  on:
4
4
  push:
5
5
  branches: [main, develop]
6
- pull_request:
7
- branches: [main]
8
-
9
- env:
10
- NODE_VERSION: '20'
11
- AWS_REGION: 'us-east-1'
12
-
13
- jobs:
14
- test:
15
- runs-on: ubuntu-latest
16
-
17
- steps:
18
- - uses: actions/checkout@v4
19
-
20
- - name: Setup Node.js
21
- uses: actions/setup-node@v4
22
- with:
23
- node-version: $\{{ env.NODE_VERSION }}
24
- cache: 'npm'
25
-
26
- - name: Install dependencies
27
- run: npm ci
28
-
29
- - name: Run linter
30
- run: npm run lint --if-present
31
-
32
- - name: Run tests
33
- run: npm test --if-present
34
-
35
- - name: Build
36
- run: npm run build
37
-
38
- build-and-push:
39
- needs: test
40
- runs-on: ubuntu-latest
41
- if: github.ref == 'refs/heads/main'
42
-
43
- steps:
44
- - uses: actions/checkout@v4
45
-
46
- - name: Configure AWS credentials
47
- uses: aws-actions/configure-aws-credentials@v4
48
- with:
49
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
50
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
51
- aws-region: $\{{ env.AWS_REGION }}
52
-
53
- - name: Login to Amazon ECR
54
- id: login-ecr
55
- uses: aws-actions/amazon-ecr-login@v2
56
-
57
- - name: Build, tag, and push image to Amazon ECR
58
- env:
59
- ECR_REGISTRY: $\{{ steps.login-ecr.outputs.registry }}
60
- ECR_REPOSITORY: {{projectNameKebabCase}}
61
- IMAGE_TAG: $\{{ github.sha }}
62
- run: |
63
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
64
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
65
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
66
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
67
-
68
- deploy:
69
- needs: build-and-push
70
- runs-on: ubuntu-latest
71
- if: github.ref == 'refs/heads/main'
72
-
73
- steps:
74
- - uses: actions/checkout@v4
75
-
76
- - name: Configure AWS credentials
77
- uses: aws-actions/configure-aws-credentials@v4
78
- with:
79
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
80
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
81
- aws-region: $\{{ env.AWS_REGION }}
82
-
83
- - name: Deploy to ECS
84
- run: |
85
- aws ecs update-service \
86
- --cluster {{projectNameKebabCase}}-prod \
87
- --service {{projectNameKebabCase}}-api \
88
- --force-new-deployment
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ PYTHON_VERSION: '3.11'
11
+ AWS_REGION: 'us-east-1'
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Setup Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ env.PYTHON_VERSION }}
24
+ cache: 'pip'
25
+
26
+ - name: Install dependencies
27
+ run: pip install -r requirements.txt
28
+
29
+ - name: Run tests
30
+ run: pytest
31
+
32
+ build-and-push:
33
+ needs: test
34
+ runs-on: ubuntu-latest
35
+ if: github.ref == 'refs/heads/main'
36
+
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ - name: Configure AWS credentials
41
+ uses: aws-actions/configure-aws-credentials@v4
42
+ with:
43
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
44
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
45
+ aws-region: ${{ env.AWS_REGION }}
46
+
47
+ - name: Login to Amazon ECR
48
+ id: login-ecr
49
+ uses: aws-actions/amazon-ecr-login@v2
50
+
51
+ - name: Build, tag, and push image to Amazon ECR
52
+ env:
53
+ ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
54
+ ECR_REPOSITORY: {{projectNameKebabCase}}
55
+ IMAGE_TAG: ${{ github.sha }}
56
+ run: |
57
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
58
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
59
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
60
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
61
+
62
+ deploy:
63
+ needs: build-and-push
64
+ runs-on: ubuntu-latest
65
+ if: github.ref == 'refs/heads/main'
66
+
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+
70
+ - name: Configure AWS credentials
71
+ uses: aws-actions/configure-aws-credentials@v4
72
+ with:
73
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
74
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
75
+ aws-region: ${{ env.AWS_REGION }}
76
+
77
+ - name: Deploy to ECS
78
+ run: |
79
+ aws ecs update-service \
80
+ --cluster {{projectNameKebabCase}}-prod \
81
+ --service {{projectNameKebabCase}}-api \
82
+ --force-new-deployment
@@ -3,86 +3,80 @@ name: CI/CD Pipeline
3
3
  on:
4
4
  push:
5
5
  branches: [main, develop]
6
- pull_request:
7
- branches: [main]
8
-
9
- env:
10
- NODE_VERSION: '20'
11
- AWS_REGION: 'us-east-1'
12
-
13
- jobs:
14
- test:
15
- runs-on: ubuntu-latest
16
-
17
- steps:
18
- - uses: actions/checkout@v4
19
-
20
- - name: Setup Node.js
21
- uses: actions/setup-node@v4
22
- with:
23
- node-version: $\{{ env.NODE_VERSION }}
24
- cache: 'npm'
25
-
26
- - name: Install dependencies
27
- run: npm ci
28
-
29
- - name: Run linter
30
- run: npm run lint --if-present
31
-
32
- - name: Run tests
33
- run: npm test --if-present
34
-
35
- - name: Build
36
- run: npm run build
37
-
38
- build-and-push:
39
- needs: test
40
- runs-on: ubuntu-latest
41
- if: github.ref == 'refs/heads/main'
42
-
43
- steps:
44
- - uses: actions/checkout@v4
45
-
46
- - name: Configure AWS credentials
47
- uses: aws-actions/configure-aws-credentials@v4
48
- with:
49
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
50
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
51
- aws-region: $\{{ env.AWS_REGION }}
52
-
53
- - name: Login to Amazon ECR
54
- id: login-ecr
55
- uses: aws-actions/amazon-ecr-login@v2
56
-
57
- - name: Build, tag, and push image to Amazon ECR
58
- env:
59
- ECR_REGISTRY: $\{{ steps.login-ecr.outputs.registry }}
60
- ECR_REPOSITORY: {{projectNameKebabCase}}
61
- IMAGE_TAG: $\{{ github.sha }}
62
- run: |
63
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
64
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
65
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
66
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
67
-
68
- deploy:
69
- needs: build-and-push
70
- runs-on: ubuntu-latest
71
- if: github.ref == 'refs/heads/main'
72
-
73
- steps:
74
- - uses: actions/checkout@v4
75
-
76
- - name: Configure AWS credentials
77
- uses: aws-actions/configure-aws-credentials@v4
78
- with:
79
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
80
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
81
- aws-region: $\{{ env.AWS_REGION }}
82
-
83
- - name: Deploy to ECS
84
- run: |
85
- aws ecs update-service \
86
- --cluster {{projectNameKebabCase}}-prod \
87
- --service {{projectNameKebabCase}}-api \
88
- --force-new-deployment
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ PYTHON_VERSION: '3.11'
11
+ AWS_REGION: 'us-east-1'
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Setup Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ env.PYTHON_VERSION }}
24
+ cache: 'pip'
25
+
26
+ - name: Install dependencies
27
+ run: pip install -r requirements.txt
28
+
29
+ - name: Run tests
30
+ run: pytest
31
+
32
+ build-and-push:
33
+ needs: test
34
+ runs-on: ubuntu-latest
35
+ if: github.ref == 'refs/heads/main'
36
+
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ - name: Configure AWS credentials
41
+ uses: aws-actions/configure-aws-credentials@v4
42
+ with:
43
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
44
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
45
+ aws-region: ${{ env.AWS_REGION }}
46
+
47
+ - name: Login to Amazon ECR
48
+ id: login-ecr
49
+ uses: aws-actions/amazon-ecr-login@v2
50
+
51
+ - name: Build, tag, and push image to Amazon ECR
52
+ env:
53
+ ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
54
+ ECR_REPOSITORY: {{projectNameKebabCase}}
55
+ IMAGE_TAG: ${{ github.sha }}
56
+ run: |
57
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
58
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
59
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
60
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
61
+
62
+ deploy:
63
+ needs: build-and-push
64
+ runs-on: ubuntu-latest
65
+ if: github.ref == 'refs/heads/main'
66
+
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+
70
+ - name: Configure AWS credentials
71
+ uses: aws-actions/configure-aws-credentials@v4
72
+ with:
73
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
74
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
75
+ aws-region: ${{ env.AWS_REGION }}
76
+
77
+ - name: Deploy to ECS
78
+ run: |
79
+ aws ecs update-service \
80
+ --cluster {{projectNameKebabCase}}-prod \
81
+ --service {{projectNameKebabCase}}-api \
82
+ --force-new-deployment
@@ -3,86 +3,80 @@ name: CI/CD Pipeline
3
3
  on:
4
4
  push:
5
5
  branches: [main, develop]
6
- pull_request:
7
- branches: [main]
8
-
9
- env:
10
- NODE_VERSION: '20'
11
- AWS_REGION: 'us-east-1'
12
-
13
- jobs:
14
- test:
15
- runs-on: ubuntu-latest
16
-
17
- steps:
18
- - uses: actions/checkout@v4
19
-
20
- - name: Setup Node.js
21
- uses: actions/setup-node@v4
22
- with:
23
- node-version: $\{{ env.NODE_VERSION }}
24
- cache: 'npm'
25
-
26
- - name: Install dependencies
27
- run: npm ci
28
-
29
- - name: Run linter
30
- run: npm run lint --if-present
31
-
32
- - name: Run tests
33
- run: npm test --if-present
34
-
35
- - name: Build
36
- run: npm run build
37
-
38
- build-and-push:
39
- needs: test
40
- runs-on: ubuntu-latest
41
- if: github.ref == 'refs/heads/main'
42
-
43
- steps:
44
- - uses: actions/checkout@v4
45
-
46
- - name: Configure AWS credentials
47
- uses: aws-actions/configure-aws-credentials@v4
48
- with:
49
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
50
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
51
- aws-region: $\{{ env.AWS_REGION }}
52
-
53
- - name: Login to Amazon ECR
54
- id: login-ecr
55
- uses: aws-actions/amazon-ecr-login@v2
56
-
57
- - name: Build, tag, and push image to Amazon ECR
58
- env:
59
- ECR_REGISTRY: $\{{ steps.login-ecr.outputs.registry }}
60
- ECR_REPOSITORY: {{projectNameKebabCase}}
61
- IMAGE_TAG: $\{{ github.sha }}
62
- run: |
63
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
64
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
65
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
66
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
67
-
68
- deploy:
69
- needs: build-and-push
70
- runs-on: ubuntu-latest
71
- if: github.ref == 'refs/heads/main'
72
-
73
- steps:
74
- - uses: actions/checkout@v4
75
-
76
- - name: Configure AWS credentials
77
- uses: aws-actions/configure-aws-credentials@v4
78
- with:
79
- aws-access-key-id: $\{{ secrets.AWS_ACCESS_KEY_ID }}
80
- aws-secret-access-key: $\{{ secrets.AWS_SECRET_ACCESS_KEY }}
81
- aws-region: $\{{ env.AWS_REGION }}
82
-
83
- - name: Deploy to ECS
84
- run: |
85
- aws ecs update-service \
86
- --cluster {{projectNameKebabCase}}-prod \
87
- --service {{projectNameKebabCase}}-api \
88
- --force-new-deployment
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ PYTHON_VERSION: '3.11'
11
+ AWS_REGION: 'us-east-1'
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Setup Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ env.PYTHON_VERSION }}
24
+ cache: 'pip'
25
+
26
+ - name: Install dependencies
27
+ run: pip install -r requirements.txt
28
+
29
+ - name: Run tests
30
+ run: pytest
31
+
32
+ build-and-push:
33
+ needs: test
34
+ runs-on: ubuntu-latest
35
+ if: github.ref == 'refs/heads/main'
36
+
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ - name: Configure AWS credentials
41
+ uses: aws-actions/configure-aws-credentials@v4
42
+ with:
43
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
44
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
45
+ aws-region: ${{ env.AWS_REGION }}
46
+
47
+ - name: Login to Amazon ECR
48
+ id: login-ecr
49
+ uses: aws-actions/amazon-ecr-login@v2
50
+
51
+ - name: Build, tag, and push image to Amazon ECR
52
+ env:
53
+ ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
54
+ ECR_REPOSITORY: {{projectNameKebabCase}}
55
+ IMAGE_TAG: ${{ github.sha }}
56
+ run: |
57
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
58
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
59
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
60
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
61
+
62
+ deploy:
63
+ needs: build-and-push
64
+ runs-on: ubuntu-latest
65
+ if: github.ref == 'refs/heads/main'
66
+
67
+ steps:
68
+ - uses: actions/checkout@v4
69
+
70
+ - name: Configure AWS credentials
71
+ uses: aws-actions/configure-aws-credentials@v4
72
+ with:
73
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
74
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
75
+ aws-region: ${{ env.AWS_REGION }}
76
+
77
+ - name: Deploy to ECS
78
+ run: |
79
+ aws ecs update-service \
80
+ --cluster {{projectNameKebabCase}}-prod \
81
+ --service {{projectNameKebabCase}}-api \
82
+ --force-new-deployment