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

Support building local docker image #565

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
46 changes: 46 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Create and publish a Docker image
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:

- name: Checkout repository
uses: actions/checkout@v4

- name: Setup JVM
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: sbt

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
run: sbt Docker/publish
14 changes: 11 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ inThisBuild(
scalaVersion := "3.4.2",
versionScheme := Some("early-semver"),
version := "3.2",
semanticdbEnabled := true // for scalafix
semanticdbEnabled := true, // for scalafix
dockerBaseImage := "openjdk:21",
dockerUpdateLatest := true
)
)

Expand All @@ -18,7 +20,7 @@ val chessVersion = "16.0.3"

lazy val `lila-ws` = project
.in(file("."))
.enablePlugins(JavaAppPackaging)
.enablePlugins(JavaAppPackaging, DockerPlugin)
.settings(
name := "lila-ws",
organization := "org.lichess",
Expand Down Expand Up @@ -63,7 +65,13 @@ lazy val `lila-ws` = project
"-Xtarget:21",
"-Wunused:all"
),
javaOptions ++= Seq("-Xms32m", "-Xmx256m")
javaOptions ++= Seq("-Xms32m", "-Xmx256m"),
Docker / packageName := "lichess-org/lila-ws",
Docker / maintainer := "lichess.org",
Docker / dockerRepository := Some("ghcr.io"),
Universal / javaOptions := Seq(
"-J-Dconfig.override_with_env_vars=true"
)
)

addCommandAlias("prepare", "scalafixAll; scalafmtAll")
Expand Down
Loading