Skip to content

Commit

Permalink
feat: demo-fs
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzc19 committed Aug 4, 2024
1 parent 098ee7e commit 678d637
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/demo-fs-spring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: demo-sl-spring

on:
workflow_dispatch:
push:
paths:
- 'v-demo/demo-fs/fs-spring/**'

env:
WORKSPACE: 'v-demo/demo-fs/fs-spring'
IMAGE_NAME: 'ghcr.io/lkzc19/demo-fs-spring'

jobs:
sl-spring-bulid:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Set up JDK 17'
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: 'Package gradle project'
run: |
cd ${{ env.WORKSPACE }}
./gradlew bootJar
- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v2
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build and push docker image'
uses: docker/build-push-action@v5
with:
context: ${{ env.WORKSPACE }}
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
${{ env.IMAGE_NAME }}:latest
10 changes: 10 additions & 0 deletions v-demo/demo-fs/fs-spring/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM bitnami/java:17

WORKDIR /app

RUN mkdir /var/vitamin/file
COPY ./build/libs/app.jar app.jar

EXPOSE 3000

ENTRYPOINT ["java", "-Dspring.profiles.active=prod", "-jar", "app.jar"]
7 changes: 7 additions & 0 deletions v-demo/demo-fs/fs-spring/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.springframework.boot.gradle.tasks.bundling.BootJar

plugins {
id("org.springframework.boot") version "3.3.2"
id("io.spring.dependency-management") version "1.1.6"
Expand Down Expand Up @@ -38,3 +40,8 @@ kotlin {
tasks.withType<Test> {
useJUnitPlatform()
}

// 如果是 Spring Boot 项目,可能需要配置 bootJar 而不是 jar
tasks.getByName<BootJar>("bootJar") {
archiveFileName.set("app.jar")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vitamin:
fs-dir: /var/vitamin/file
prefix: https://fs.drinkice.xyz/file

0 comments on commit 678d637

Please sign in to comment.