Skip to content

Instantly share code, notes, and snippets.

@Babali42
Created December 4, 2024 09:14
Show Gist options
  • Save Babali42/21de324f01580fa0278fa2517b656277 to your computer and use it in GitHub Desktop.
Save Babali42/21de324f01580fa0278fa2517b656277 to your computer and use it in GitHub Desktop.
services:
application:
image: my-play-app
ports:
- "9000:9000"
# Use an official Scala image as the base image
FROM sbtscala/scala-sbt:graalvm-ce-22.3.3-b1-java17_1.10.1_3.4.2 AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy the project files into the container
COPY . .
# Compile the application and create a distribution package
RUN sbt clean compile stage
# Use a lightweight JRE image for running the app
FROM openjdk:11-jre-slim
# Set the working directory inside the container
WORKDIR /app
# Copy the distribution package from the builder stage
COPY --from=builder /app/target/universal/stage /app
# Expose the port that your Play app listens on
EXPOSE 9000
# Set the entry point to start the Play application
ENTRYPOINT ["./bin/play-scala-rest-api-example"]
# Pass environment variables for configuration
# CMD ["-Dplay.http.secret.key=${PLAY_HTTP_SECRET_KEY}"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment