feat(docker): added docker container support (#47)
Reviewed-on: #47 Co-authored-by: Janis <janis.e.20@gmx.de> Co-committed-by: Janis <janis.e.20@gmx.de>
This commit is contained in:
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -138,3 +138,4 @@ target
|
|||||||
/knockoutwhistweb/.g8/
|
/knockoutwhistweb/.g8/
|
||||||
/knockoutwhistweb/.bsp/
|
/knockoutwhistweb/.bsp/
|
||||||
/currentSnapshot.json
|
/currentSnapshot.json
|
||||||
|
.env
|
||||||
2
.sbtopts
Normal file
2
.sbtopts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
-J--add-opens=java.base/java.util=ALL-UNNAMED
|
||||||
|
-J--add-opens=java.base/java.lang=ALL-UNNAMED
|
||||||
41
Dockerfile
Normal file
41
Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# === Stage 1: Build the Play application ===
|
||||||
|
FROM sbtscala/scala-sbt:eclipse-temurin-alpine-22_36_1.10.3_3.5.1 AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install Node.js and Less CSS preprocessor
|
||||||
|
USER root
|
||||||
|
RUN apk add --no-cache nodejs npm && \
|
||||||
|
npm install -g less
|
||||||
|
|
||||||
|
# Cache dependencies first
|
||||||
|
COPY project ./project
|
||||||
|
COPY build.sbt ./
|
||||||
|
RUN sbt -Dscoverage.skip=true update
|
||||||
|
|
||||||
|
# Copy the rest of the code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the app and stage it
|
||||||
|
RUN sbt -Dscoverage.skip=true clean stage
|
||||||
|
|
||||||
|
# === Stage 2: Runtime image ===
|
||||||
|
FROM eclipse-temurin:21-jre-alpine
|
||||||
|
|
||||||
|
# Install Argon2 CLI and libraries
|
||||||
|
RUN apk add --no-cache bash argon2 argon2-libs
|
||||||
|
|
||||||
|
WORKDIR /opt/playapp
|
||||||
|
|
||||||
|
# Copy staged Play build
|
||||||
|
COPY --from=builder /app/knockoutwhistweb/target/universal/stage /opt/playapp
|
||||||
|
|
||||||
|
# Expose the default Play port
|
||||||
|
EXPOSE 9000
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PLAY_HTTP_PORT=9000
|
||||||
|
|
||||||
|
# Run the Play app
|
||||||
|
ENTRYPOINT ["./bin/knockoutwhistweb"]
|
||||||
|
CMD ["-Dplay.server.pidfile.path=/dev/null"]
|
||||||
@@ -19,7 +19,6 @@ lazy val commonSettings = Seq(
|
|||||||
.map(m => "org.openjfx" % s"javafx-$m" % "21" classifier osName)
|
.map(m => "org.openjfx" % s"javafx-$m" % "21" classifier osName)
|
||||||
},
|
},
|
||||||
libraryDependencies += guice,
|
libraryDependencies += guice,
|
||||||
coverageEnabled := true,
|
|
||||||
coverageFailOnMinimum := true,
|
coverageFailOnMinimum := true,
|
||||||
coverageMinimumStmtTotal := 85,
|
coverageMinimumStmtTotal := 85,
|
||||||
coverageMinimumBranchTotal := 100
|
coverageMinimumBranchTotal := 100
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class AuthAction @Inject()(val sessionManager: SessionManager, val parser: BodyP
|
|||||||
|
|
||||||
override def executionContext: ExecutionContext = ec
|
override def executionContext: ExecutionContext = ec
|
||||||
|
|
||||||
private def getUserFromSession(request: RequestHeader): Option[User] = {
|
protected def getUserFromSession(request: RequestHeader): Option[User] = {
|
||||||
val session = request.cookies.get("sessionId")
|
val session = request.cookies.get("sessionId")
|
||||||
if (session.isDefined)
|
if (session.isDefined)
|
||||||
return sessionManager.getUserBySession(session.get.value)
|
return sessionManager.getUserBySession(session.get.value)
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
play.filters.disabled += play.filters.csrf.CSRFFilter
|
play.filters.disabled += play.filters.csrf.CSRFFilter
|
||||||
play.filters.disabled += play.filters.hosts.AllowedHostsFilter
|
play.filters.disabled += play.filters.hosts.AllowedHostsFilter
|
||||||
|
|
||||||
|
play.http.secret.key="QCY?tAnfk?aZ?iwrNwnxIlR6CTf:G3gf:90Latabg@5241AB`R5W:1uDFN];Ik@n"
|
||||||
|
play.http.secret.key=${?APPLICATION_SECRET}
|
||||||
|
|
||||||
auth {
|
auth {
|
||||||
issuer = "knockoutwhistweb"
|
issuer = "knockoutwhistweb"
|
||||||
audience = "ui"
|
audience = "ui"
|
||||||
# ${?PUBLIC_KEY_FILE}
|
privateKeyFile = ${?PRIVATE_KEY_FILE}
|
||||||
privateKeyFile = "/home/janis/Workspaces/IntelliJ/KnockOutWhist/Gitops/rsa512-private.pem"
|
privateKeyPem = ${?PRIVATE_KEY_PEM}
|
||||||
privateKeyPem = ${?PUBLIC_KEY_PEM}
|
publicKeyFile = ${?PUBLIC_KEY_FILE}
|
||||||
#${?PUBLIC_KEY_FILE}
|
|
||||||
publicKeyFile = "/home/janis/Workspaces/IntelliJ/KnockOutWhist/Gitops/rsa512-public.pem"
|
|
||||||
publicKeyPem = ${?PUBLIC_KEY_PEM}
|
publicKeyPem = ${?PUBLIC_KEY_PEM}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user