Skip to content

Commit

Permalink
Splitting the build process into two phases
Browse files Browse the repository at this point in the history
  • Loading branch information
daithihearn committed Aug 20, 2023
1 parent 6f393f5 commit 7a449f6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/publish-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ jobs:
runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- name: Set up Docker
uses: docker/setup-buildx-action@v2
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v3
- name: Build Bootable JAR
run: |
docker build -f Dockerfile.build -t builder-image .
docker run --rm builder-image > app.jar
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and publish Docker image
- name: Build and publish Docker image for multiple architectures
run: |
docker buildx build --platform linux/amd64,linux/arm64/v8 -t daithihearn/electricity-prices:latest -t daithihearn/electricity-prices:${{ github.ref_name }} --push .
docker buildx build --platform linux/amd64,linux/arm64/v8,linux/arm/v7 -f Dockerfile.deploy -t daithihearn/electricity-prices:latest -t daithihearn/electricity-prices:${{ github.ref_name }} --push .
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.6
1.8.7
18 changes: 18 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM eclipse-temurin:17 AS builder

WORKDIR /opt/app

COPY ./gradle ./gradle
COPY ./gradlew ./

RUN ./gradlew

COPY ./build.gradle.kts ./
COPY ./settings.gradle ./
COPY ./system.properties ./
COPY ./.version ./
COPY ./src ./src

RUN ./gradlew build publishToMavenLocal

CMD ["cat", "/opt/app/build/libs/electricity-prices*.jar"]
7 changes: 7 additions & 0 deletions Dockerfile.deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM eclipse-temurin:17

WORKDIR /opt/app

COPY app.jar /opt/app/app.jar

ENTRYPOINT ["java", "-Djdk.tls.client.protocols=TLSv1.2", "-jar", "./app.jar", "-XX:+UseContainerSupport"]

0 comments on commit 7a449f6

Please sign in to comment.