diff --git a/.dockerignore b/.dockerignore index 4ac1703..f5caf90 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,8 +1,8 @@ .* build bin -Dockerfile -Dockerfile.* +Dockerfile* +docker-compose.yml *.bat LICENSE *.md diff --git a/.github/workflows/docker-build-test.yml b/.github/workflows/docker-build-test.yml index 7a129b4..356688c 100644 --- a/.github/workflows/docker-build-test.yml +++ b/.github/workflows/docker-build-test.yml @@ -4,10 +4,12 @@ on: push: paths-ignore: - "**.md" + branches: + - master pull_request: jobs: - build-hotspot-test: + build-test: runs-on: ubuntu-latest strategy: matrix: @@ -16,6 +18,10 @@ jobs: - testing/docker-compose.hsqldb.yml - testing/docker-compose.cockroachdb.yml - testing/docker-compose.yugabytedb.yml + dockerfile: + - Dockerfile + - Dockerfile.openj9 + - Dockerfile.graalvm-jvm steps: - uses: actions/checkout@v3 - name: Create Version File @@ -25,8 +31,12 @@ jobs: with: context: . load: true + file: ${{ matrix.dockerfile }} tags: 1337kavin/piped:latest - name: Start Docker-Compose services - run: docker-compose -f ${{ matrix.docker-compose-file }} up -d && sleep 5 + run: docker-compose -f ${{ matrix.docker-compose-file }} up -d && sleep 20 - name: Run tests run: ./testing/api-test.sh + - name: Collect services logs + if: failure() + run: docker-compose -f ${{ matrix.docker-compose-file }} logs diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 2e06036..1d2b2e0 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -68,3 +68,33 @@ jobs: tags: 1337kavin/piped:latest,1337kavin/piped:openj9 cache-from: type=gha cache-to: type=gha,mode=max + build-docker-graalvm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Create Version File + run: echo $(git log -1 --date=short --pretty=format:%cd)-$(git rev-parse --short HEAD) > VERSION + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.0.0 + with: + platforms: all + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2.0.0 + with: + version: latest + - name: Login to DockerHub + uses: docker/login-action@v2.0.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build and push + uses: docker/build-push-action@v3.0.0 + with: + context: . + file: ./Dockerfile.graalvm-jvm + platforms: linux/amd64,linux/arm64 + push: true + tags: 1337kavin/piped:graalvm-jvm + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile.graalvm-jvm b/Dockerfile.graalvm-jvm new file mode 100644 index 0000000..1e07549 --- /dev/null +++ b/Dockerfile.graalvm-jvm @@ -0,0 +1,32 @@ +FROM ghcr.io/graalvm/native-image:latest as build + +WORKDIR /app/ + +COPY . /app/ + +RUN --mount=type=cache,target=/root/.gradle/caches/ \ + ./gradlew shadowJar + +RUN jlink \ + --add-modules java.base,java.logging,java.sql,java.management,java.xml,java.naming,java.desktop,jdk.crypto.ec \ + --strip-debug \ + --no-man-pages \ + --no-header-files \ + --compress=2 \ + --output /javaruntime + +FROM debian:stable-slim + +ENV JAVA_HOME=/opt/java/openjdk +ENV PATH "${JAVA_HOME}/bin:${PATH}" +COPY --from=build /javaruntime $JAVA_HOME + +WORKDIR /app/ + +COPY --from=build /app/build/libs/piped-1.0-all.jar /app/piped.jar + +COPY VERSION . + +EXPOSE 8080 + +CMD java -jar /app/piped.jar diff --git a/testing/docker-compose.yugabytedb.yml b/testing/docker-compose.yugabytedb.yml index dfa82fa..2258648 100644 --- a/testing/docker-compose.yugabytedb.yml +++ b/testing/docker-compose.yugabytedb.yml @@ -8,6 +8,7 @@ services: - ./config.yugabytedb.properties:/app/config.properties depends_on: - yb-tserver + command: [ "sh", "-c", "sleep 10 && java -jar piped.jar" ] yb-master: image: yugabytedb/yugabyte:latest command: