-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish docker images for microservices
- Loading branch information
Showing
5 changed files
with
134 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
java: [ '[email protected]' ] | ||
java: [ 17 ] | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
|
@@ -24,13 +24,13 @@ jobs: | |
# uses: coursier/cache-action@v6 | ||
- name: sbt ci ${{ github.ref }} | ||
run: sbt -mem 2048 ci | ||
# - name: Log in to Docker Hub | ||
# uses: docker/login-action@v2 | ||
# with: | ||
# username: ${{ secrets.RENKU_DOCKER_USERNAME }} | ||
# password: ${{ secrets.RENKU_DOCKER_PASSWORD }} | ||
# - name: sbt docker:publishLocal | ||
# run: sbt -mem 2048 cli/Docker/publishLocal | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.RENKU_DOCKER_USERNAME }} | ||
password: ${{ secrets.RENKU_DOCKER_PASSWORD }} | ||
- name: sbt docker:publishLocal | ||
run: sbt -mem 2048 search-provision/Docker/publishLocal search-api/Docker/publishLocal | ||
ci: | ||
runs-on: ubuntu-latest | ||
needs: [ci-matrix] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: [ main ] | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
java: [ 17 ] | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
- uses: olafurpg/setup-scala@v14 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
|
||
- name: Set current version | ||
id: version | ||
shell: bash | ||
run: | | ||
sbt 'renku-search/writeVersion' | ||
RS_VERSION=$(cat target/version.txt) | ||
echo "RS_VERSION=${RS_VERSION}" >> $GITHUB_ENV | ||
if [ -z "${RS_VERSION}" ]; then | ||
echo "Version not set!" | ||
exit 1 | ||
fi | ||
- name: Create zip packages | ||
run: sbt -mem 2048 search-provision/Universal/packageBin search-api/Universal/packageBin | ||
|
||
- name: Publish Release (${{ env.RS_VERSION }}) | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
with: | ||
files: | | ||
modules/search-provision/target/universal/search-provision-${{ env.RS_VERSION }}.zip | ||
modules/search-api/target/universal/search-api-${{ env.RS_VERSION }}.zip | ||
- name: Publish Pre-Release | ||
uses: ncipollo/release-action@v1 | ||
if: ${{ github.ref }} == 'refs/heads/main' | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
with: | ||
token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: true | ||
allowUpdates: true | ||
tag: "nightly" | ||
commit: "main" | ||
body: "Floating tag associating the latest build from the main branch" | ||
name: "renku search nightly" | ||
replacesArtifacts: true | ||
removeArtifacts: true | ||
artifacts: | | ||
modules/search-provision/target/universal/search-provision-${{ env.RS_VERSION }}.zip, | ||
modules/search-api/target/universal/search-api-${{ env.RS_VERSION }}.zip | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.RENKU_DOCKER_USERNAME }} | ||
password: ${{ secrets.RENKU_DOCKER_PASSWORD }} | ||
- name: sbt Docker/publish | ||
run: sbt -mem 2048 search-provision/Docker/publish search-api/Docker/publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import com.typesafe.sbt.packager.docker._ | ||
import com.typesafe.sbt.packager.Keys._ | ||
import com.typesafe.sbt.packager.archetypes.JavaServerAppPackaging | ||
import sbt._ | ||
import sbt.Keys._ | ||
import com.github.sbt.git.SbtGit.git | ||
import sbtdynver._ | ||
import sbtdynver.DynVerPlugin.autoImport._ | ||
|
||
/** Sets default docker image settings for sbt-native-packager's `DockerPlugin`. */ | ||
object DockerImagePlugin extends AutoPlugin { | ||
|
||
// Load DockerPlugin and JavaServerAppPackaging whenever this plugin is enabled | ||
override def requires = DockerPlugin && JavaServerAppPackaging && DynVerPlugin | ||
override def trigger = allRequirements | ||
|
||
import DockerPlugin.autoImport._ | ||
|
||
val dockerSettings = Seq( | ||
dockerUpdateLatest := true, | ||
// dockerEntrypoint := Seq(s"bin/${executableScriptName.value}", "-Duser.timezone=UTC", "$JAVA_OPTS"), | ||
dockerBaseImage := s"eclipse-temurin:21-jre", | ||
// derive a package name | ||
Docker / packageName := (Compile / name).value, | ||
dockerRepository := Some("docker.io"), | ||
dockerUsername := Some("renku"), | ||
|
||
// temporarily use git hash as image tag | ||
Docker / version := git.gitHeadCommit.value | ||
.map(_.take(12)) | ||
.getOrElse((Compile / version).value) | ||
) | ||
|
||
private def imageTag(out: Option[GitDescribeOutput], headCommit: Option[String]) = | ||
out match { | ||
case Some(d) if d.isCleanAfterTag => Some(d.ref.dropPrefix) | ||
case _ => headCommit.map(_.take(12)) | ||
} | ||
|
||
override def projectSettings = | ||
dockerSettings | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters