Skip to content

Commit

Permalink
fix: reuse build artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmelati committed Jan 16, 2025
1 parent ad423e4 commit 24627f0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
10 changes: 5 additions & 5 deletions .docker/admin-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ FROM openjdk:21-jdk AS builder
RUN microdnf install findutils

WORKDIR /app

COPY . /app

RUN chmod +x ./gradlew

RUN ./gradlew :modules:admin-server:bootJar -x test -x allTests -x jsBrowserTest
RUN if [ ! -f modules/admin-server/build/libs/admin-server-*.jar ]; then \
./gradlew :modules:admin-server:bootJar -x test -x allTests -x jsBrowserTest; \
fi

FROM openjdk:21-jdk AS runner
FROM openjdk:21-jdk
RUN microdnf install curl

WORKDIR /app
Expand All @@ -22,4 +22,4 @@ RUN useradd -r -u 1002 -g root admin-server
USER admin-server

ENTRYPOINT ["java"]
CMD ["-XX:MaxRAMPercentage=75.0", "-XX:InitialRAMPercentage=50.0", "-XX:+UseG1GC", "-jar", "admin-server.jar"]
CMD ["-XX:MaxRAMPercentage=75.0", "-XX:InitialRAMPercentage=50.0", "-XX:+UseG1GC", "-jar", "admin-server.jar"]
12 changes: 7 additions & 5 deletions .docker/federation-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ FROM openjdk:21-jdk AS builder
RUN microdnf install findutils

WORKDIR /app

COPY . /app

RUN chmod +x ./gradlew

RUN ./gradlew :modules:federation-server:bootJar -x test -x allTests -x jsBrowserTest
RUN if [ ! -f modules/federation-server/build/libs/federation-server-*.jar ]; then \
./gradlew :modules:federation-server:bootJar -x test -x allTests -x jsBrowserTest; \
fi

FROM openjdk:21-jdk AS runner
FROM openjdk:21-jdk
RUN microdnf install curl

WORKDIR /app
Expand All @@ -22,4 +22,6 @@ RUN useradd -r -u 1001 -g root federation-server
USER federation-server

ENTRYPOINT ["java"]
CMD ["-XX:MaxRAMPercentage=75.0", "-XX:InitialRAMPercentage=50.0", "-XX:+UseG1GC", "-jar", "federation-server.jar"]
CMD ["-XX:MaxRAMPercentage=75.0", "-XX:InitialRAMPercentage=50.0", "-XX:+UseG1GC", "-jar", "federation-server.jar"]

WORKDIR /app
24 changes: 23 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ jobs:
./gradlew publishJsPackageToNpmjsRegistry
./gradlew publishAllPublicationsToSphereon-opensourceRepository
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
modules/federation-server/build/libs/federation-server-*.jar
modules/admin-server/build/libs/admin-server-*.jar
auto-tag:
needs: gradle
runs-on: ubuntu-latest
Expand Down Expand Up @@ -130,6 +137,22 @@ jobs:
with:
fetch-depth: 0

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ./

- name: Create directory structure
run: |
mkdir -p modules/federation-server/build/libs/
mkdir -p modules/admin-server/build/libs/
mv federation-server-*.jar modules/federation-server/build/libs/
mv admin-server-*.jar modules/admin-server/build/libs/
- name: List downloaded artifacts
run: ls -R modules/*/build/libs/

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
Expand All @@ -138,7 +161,6 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata (federation-server)
id: meta-federation
uses: docker/metadata-action@v5
Expand Down

0 comments on commit 24627f0

Please sign in to comment.