Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change base image to arm64/amd64 compat #378

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ jobs:
env:
IMAGE_NAME: "odinson-extras"
# --output=type=docker
# FIXME: temporary disable ARM64 publishing until next version of processors is released (see https://github.com/clulab/processors/pull/598)
run: |
docker buildx build --platform=linux/amd64,linux/arm64 -f ${{ env.DOCKERFILE }} --push -t "${{ env.ORG }}/$IMAGE_NAME:latest" -t "${{ env.ORG }}/$IMAGE_NAME:${{ needs.setup.outputs.sha_short }}" .
docker buildx build --platform=linux/amd64 -f ${{ env.DOCKERFILE }} --push -t "${{ env.ORG }}/$IMAGE_NAME:latest" -t "${{ env.ORG }}/$IMAGE_NAME:${{ needs.setup.outputs.sha_short }}" .
#docker buildx build --platform=linux/amd64,linux/arm64 -f ${{ env.DOCKERFILE }} --push -t "${{ env.ORG }}/$IMAGE_NAME:latest" -t "${{ env.ORG }}/$IMAGE_NAME:${{ needs.setup.outputs.sha_short }}" .
# # publish
# - name: "Publish docker `lumai/odinson-extras` image"
# env:
Expand Down
18 changes: 12 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,29 @@ lazy val extra = project
// Docker settings
val gitDockerTag = settingKey[String]("Git commit-based tag for docker")
ThisBuild / gitDockerTag := {
val shortHash: String = git.gitHeadCommit.value.get.take(7)
val uncommittedChanges: Boolean = (git.gitUncommittedChanges).value
s"""${shortHash}${if (uncommittedChanges) "-DIRTY" else ""}"""
git.gitHeadCommit.value match {
case Some(commit) =>
val shortHash: String = commit.take(7)
val uncommittedChanges: Boolean = (git.gitUncommittedChanges).value
s"""${shortHash}${if (uncommittedChanges) "-DIRTY" else ""}"""
case None => "latest"
}
}

lazy val generalDockerSettings = {
Seq(
ThisBuild / parallelExecution := false,
// see https://www.scala-sbt.org/sbt-native-packager/formats/docker.html
Docker / daemonUserUid := None,
Docker / daemonUser := "root",
Docker / daemonUserUid := Some("1002"),
Docker / daemonUser := "odinson",
Docker / packageName := "odinson-rest-api",
dockerBaseImage := "eclipse-temurin:11-jre-focal", // arm46 and amd64 compat
dockerUsername := Some("lumai"),
dockerAliases ++= Seq(
dockerAlias.value.withTag(Option("latest")),
dockerAlias.value.withTag(Option(gitDockerTag.value))
),
Docker / maintainer := "Gus Hahn-Powell <[email protected]>",
dockerBaseImage := "adoptopenjdk/openjdk11",
Universal / javaOptions ++= Seq(
"-Dodinson.dataDir=/app/data/odinson"
)
Expand Down Expand Up @@ -132,4 +137,5 @@ ThisBuild / developers := List(

// tasks
addCommandAlias("dockerize", ";clean;compile;test;docker:publishLocal")
addCommandAlias("dockerfile", ";clean;compile;docker:stage")
addCommandAlias("dockerizeAndPublish", ";clean;compile;test;docker:publish")
6 changes: 3 additions & 3 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ See [our repository](https://hub.docker.com/r/lumai/odinson-extras) for other ta
### Annotating text using the docker image

```bash
docker run \
docker run --platform linux/amd64 \
--name="odinson-extras" \
-it \
--rm \
-e "HOME=/app" \
-e "JAVA_OPTS=-Dodinson.extra.processorType=CluProcessor" \
-v "/path/to/data/odinson:/app/data/odinson" \
-e "JAVA_OPTS=-Xmx4G -Dodinson.extra.processorType=CluProcessor" \
-v "${PWD}/extra/src/test/resources:/app/data/odinson" \
--entrypoint "bin/annotate-text" \
"lumai/odinson-extras:latest"
```
Expand Down
Loading