Skip to content

Commit

Permalink
修复 项目无法编译问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kkangert committed Jul 21, 2024
1 parent aba22ef commit 32e1452
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [published]

jobs:
build:
build_push_dockerhub:
runs-on: ubuntu-latest

steps:
Expand All @@ -17,26 +17,12 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew :bootJar

push:
runs-on: ubuntu-latest
needs: [build]
steps:
- run: pwd
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
file: Dockerfile
push: true
tags: |
kkangert/test:latest
kkangert/test:${{ github.event.release.tag_name }}
${{ github.repository }}:latest
${{ github.repository }}:${{ github.event.release.tag_name }}
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# step1
FROM openjdk:17.0.2-slim-bullseye as builds

# 设置工作目录
WORKDIR /app
COPY . /app/

RUN ls -alh

# 编译
RUN chmod +x ./gradlew && ./gradlew kspider-web:bootJar

# step2
FROM openjdk:17.0.2-slim-bullseye

# 镜像信息
Expand All @@ -7,11 +20,8 @@ LABEL kangert <kangert@qq.com>
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN.UTF-8

# 设置工作空间
WORKDIR /opt

# 复制jar包
COPY ./kspider-web/build/libs/kspider-web-0.0.1-SNAPSHOT.jar /opt/app.jar
COPY --from=builds /app/kspider-web/build/libs/kspider-web-0.0.1-SNAPSHOT.jar /opt/app.jar

# 暴露端口
EXPOSE 8086
Expand Down

0 comments on commit 32e1452

Please sign in to comment.