Skip to content

Commit

Permalink
Fix docker build test to use multiarch build (genome-nexus#712)
Browse files Browse the repository at this point in the history
* Fix docker build test to use multiarch build

* Switch to temurin image
  • Loading branch information
inodb committed Sep 21, 2023
1 parent 7a4dc7a commit d80c520
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/test_docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,30 @@ jobs:
steps:
- name: 'Checkout git repo'
uses: actions/checkout@v1
- name: Build Docker image
uses: docker/build-push-action@v1.0.1
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
repository: genomenexus/gn-spring-boot
# don't push, since this is a test
images: |
genomenexus/gn-spring-boot
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
# The following two actions are required to build multi-platform images
# buildx is an extension of docker build, QUEM is used to convert the binary to varies architecture
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker Image
uses: docker/build-push-action@v3
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64
file: Dockerfile
cache-from: type=gha
cache-to: type=gha
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM maven:3.6-jdk-13
FROM maven:3-eclipse-temurin-11
RUN mkdir /genome-nexus
ADD . /genome-nexus
WORKDIR /genome-nexus
RUN mvn -DskipTests clean install

FROM openjdk:13-slim
FROM eclipse-temurin:11
COPY --from=0 /genome-nexus/web/target/*.war /app.war
CMD ["java", "-Dspring.data.mongodb.uri=${MONGODB_URI}", "-jar", "/app.war"]

0 comments on commit d80c520

Please sign in to comment.