Skip to content

Commit

Permalink
ci: add docker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
D-D-H committed Oct 13, 2023
1 parent bcf0e69 commit 77f2d6b
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/commit-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# SPDX-License-Identifier: EPL-2.0
#

name: commit-check
name: Commit Check

on: [push, pull_request]

Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright (c) 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0
#
# SPDX-License-Identifier: EPL-2.0
#

name: Build and Push Docker Image

on: workflow_dispatch

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: read-version
run: |
version=$(head -n 1 version)
echo "::set-output name=version::$version"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME}}
password: ${{ secrets.DOCKER_PASSWORD}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: eclipsejifa/jifa:${{ steps.read-version.outputs.version }}
13 changes: 13 additions & 0 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#
# Copyright (c) 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0
#
# SPDX-License-Identifier: EPL-2.0
#

name: Deploy Site to Pages

on: workflow_dispatch
Expand Down
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
FROM --platform=linux/amd64 eclipse-temurin:17.0.5_8-jdk-alpine
WORKDIR /wd
FROM node:18 AS build
RUN apt-get update && apt-get install openjdk-17-jdk -y
WORKDIR /workspace/
COPY . /workspace/
RUN --mount=type=cache,target=/root/.gradle ./gradlew clean build -x test
RUN mkdir -p server/build/dependency && (cd server/build/dependency; jar -xf ../libs/jifa.jar)

ARG BUILD_JAR=jifa.jar

COPY ./server/build/libs/${BUILD_JAR} jifa.jar

CMD ["java","-jar","/wd/jifa.jar"]
FROM eclipse-temurin:17-jdk
VOLUME /tmp
ARG DEPENDENCY=/workspace/server/build/dependency
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /jifa/lib
COPY --from=build ${DEPENDENCY}/META-INF /jifa/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /jifa
ENTRYPOINT ["java","-Djdk.util.zip.disableZip64ExtraFieldValidation=true","-cp","jifa:jifa/lib/*","org.eclipse.jifa.server.Launcher"]
8 changes: 6 additions & 2 deletions server/server.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ tasks.named("processResources") {
}

// for kryo
applicationDefaultJvmArgs = ['--add-opens=java.base/java.lang=ALL-UNNAMED', '--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED']
applicationDefaultJvmArgs = ['--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED',
'-Djdk.util.zip.disableZip64ExtraFieldValidation=true']

import java.nio.file.Files
import java.security.KeyPair
Expand Down Expand Up @@ -105,7 +107,9 @@ afterEvaluate {
import org.springframework.boot.gradle.tasks.run.BootRun

static void setJvmOptionsAndDevKeys(BootRun bootRun) {
bootRun.jvmArgs('--add-opens=java.base/java.lang=ALL-UNNAMED', '--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED')
bootRun.jvmArgs('--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED',
'-Djdk.util.zip.disableZip64ExtraFieldValidation=true')
bootRun.args('--jifa.public-key=file:' + bootRun.project.projectDir.toPath().resolve('dev_rsa.pub').toAbsolutePath().toString())
bootRun.args('--jifa.private-key=file:' + bootRun.project.projectDir.toPath().resolve('dev_rsa').toAbsolutePath().toString())
}
Expand Down

0 comments on commit 77f2d6b

Please sign in to comment.