Skip to content

Commit f6a2391

Browse files
committed
first commit
0 parents  commit f6a2391

19 files changed

+649
-0
lines changed

.dockerignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.gradle
2+
.git
3+
.idea
4+
build
5+
!app/build/libs/*.jar
6+
*.md
7+
*.log

.github/workflows/deploy.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy to cloudtype
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Connect deploy key
13+
uses: cloudtype-github-actions/connect@v1
14+
with:
15+
token: ${{ secrets.CLOUDTYPE_TOKEN }}
16+
ghtoken: ${{ secrets.GHP_TOKEN }}
17+
- name: Deploy
18+
uses: cloudtype-github-actions/deploy@v1
19+
with:
20+
token: ${{ secrets.CLOUDTYPE_TOKEN }}
21+
project: cloudtype-tutorial/github-actions
22+
stage: main
23+
yaml: |
24+
name: springboot-crud-example
25+
app: java@17
26+
options:
27+
ports: 8080
28+
env:
29+
- name: JAVA_OPTS
30+
value: -Xms256m -Xmx512m
31+
- name: SPRING_PROFILES_ACTIVE
32+
value: dev
33+
buildenv: []
34+
context:
35+
git:
36+
url: [email protected]:${{ github.repository }}.git
37+
ref: ${{ github.ref }}
38+
preset: java-springboot
39+

.gitignore

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
HELP.md
2+
.gradle
3+
build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
!**/src/main/**/build/
6+
!**/src/test/**/build/
7+
8+
### STS ###
9+
.apt_generated
10+
.classpath
11+
.factorypath
12+
.project
13+
.settings
14+
.springBeans
15+
.sts4-cache
16+
bin/
17+
!**/src/main/**/bin/
18+
!**/src/test/**/bin/
19+
20+
### IntelliJ IDEA ###
21+
.idea
22+
*.iws
23+
*.iml
24+
*.ipr
25+
out/
26+
!**/src/main/**/out/
27+
!**/src/test/**/out/
28+
29+
### NetBeans ###
30+
/nbproject/private/
31+
/nbbuild/
32+
/dist/
33+
/nbdist/
34+
/.nb-gradle/
35+
36+
### VS Code ###
37+
.vscode/
38+
39+
### Kotlin ###
40+
.kotlin

Dockerfile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Build
2+
FROM eclipse-temurin:17-alpine AS build
3+
RUN apk add --no-cache bash
4+
5+
WORKDIR /app
6+
7+
COPY gradlew .
8+
COPY gradle gradle
9+
COPY build.gradle.kts settings.gradle.kts ./
10+
11+
RUN ./gradlew dependencies --no-daemon
12+
13+
COPY . .
14+
15+
RUN chmod +x ./gradlew
16+
17+
RUN ./gradlew build --no-daemon -x test
18+
19+
20+
# Runtime
21+
FROM eclipse-temurin:17-jre-alpine
22+
WORKDIR /app
23+
24+
RUN addgroup -g 1000 worker && \
25+
adduser -u 1000 -G worker -s /bin/sh -D worker
26+
27+
COPY --from=build --chown=worker:worker /app/build/libs/*.jar ./main.jar
28+
29+
USER worker:worker
30+
31+
EXPOSE 8080
32+
33+
ENTRYPOINT ["java", "-Dspring.profiles.active=${PROFILE}", "-jar", "main.jar"]

build.gradle.kts

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
plugins {
2+
id("org.springframework.boot") version "3.2.7"
3+
id("io.spring.dependency-management") version "1.1.5"
4+
kotlin("plugin.jpa") version "1.9.24"
5+
kotlin("jvm") version "1.9.24"
6+
kotlin("plugin.spring") version "1.9.24"
7+
}
8+
9+
group = "io.cloudtype"
10+
version = "0.0.1-SNAPSHOT"
11+
12+
java {
13+
toolchain {
14+
languageVersion = JavaLanguageVersion.of(17)
15+
}
16+
}
17+
18+
configurations {
19+
compileOnly {
20+
extendsFrom(configurations.annotationProcessor.get())
21+
}
22+
}
23+
24+
repositories {
25+
mavenCentral()
26+
}
27+
28+
dependencies {
29+
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
30+
implementation("org.springframework.boot:spring-boot-starter-web")
31+
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
32+
implementation("org.jetbrains.kotlin:kotlin-reflect")
33+
runtimeOnly("com.h2database:h2")
34+
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
35+
testImplementation("org.springframework.boot:spring-boot-starter-test")
36+
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
37+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
38+
}
39+
40+
kotlin {
41+
compilerOptions {
42+
freeCompilerArgs.addAll("-Xjsr305=strict")
43+
}
44+
}
45+
46+
tasks.withType<Test> {
47+
useJUnitPlatform()
48+
}

gradle/wrapper/gradle-wrapper.jar

42.4 KB
Binary file not shown.
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)