fix: build JAR locally, use minimal JRE image
Some checks failed
Build & Deploy Java API / build (push) Failing after 40s
Some checks failed
Build & Deploy Java API / build (push) Failing after 40s
This commit is contained in:
@@ -15,7 +15,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Install build tools
|
- name: Install build tools
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache curl git docker-cli 2>/dev/null || true
|
apk add --no-cache curl git docker-cli maven openjdk17 2>/dev/null || true
|
||||||
|
|
||||||
- name: Clone + prepare
|
- name: Clone + prepare
|
||||||
run: |
|
run: |
|
||||||
@@ -25,6 +25,11 @@ jobs:
|
|||||||
cd "$WORK"
|
cd "$WORK"
|
||||||
git clone https://joe:${GITEA_TOKEN}@git.cjjhc.top/joe/${{ env.APP_NAME }}.git .
|
git clone https://joe:${GITEA_TOKEN}@git.cjjhc.top/joe/${{ env.APP_NAME }}.git .
|
||||||
|
|
||||||
|
- name: Build JAR
|
||||||
|
run: |
|
||||||
|
cd /root/.cache/${{ env.APP_NAME }}
|
||||||
|
mvn clean package -DskipTests
|
||||||
|
|
||||||
- name: Login to Harbor
|
- name: Login to Harbor
|
||||||
run: docker login ${{ env.REGISTRY }} -u admin -p "$HARBOR_PASSWORD"
|
run: docker login ${{ env.REGISTRY }} -u admin -p "$HARBOR_PASSWORD"
|
||||||
env:
|
env:
|
||||||
|
|||||||
12
Dockerfile
12
Dockerfile
@@ -1,16 +1,8 @@
|
|||||||
# Multi-stage build with Chinese registry mirror
|
# Production image - JAR is pre-built locally
|
||||||
FROM registry.cn-hangzhou.aliyuncs.com/chenxipan/maven:3.9-eclipse-temurin-17 AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY pom.xml .
|
|
||||||
COPY src ./src
|
|
||||||
RUN mvn clean package -DskipTests
|
|
||||||
|
|
||||||
# Production stage
|
|
||||||
FROM eclipse-temurin:17-jre-alpine
|
FROM eclipse-temurin:17-jre-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /app/target/*.jar app.jar
|
COPY target/*.jar app.jar
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user