Created
December 4, 2024 09:14
-
-
Save Babali42/21de324f01580fa0278fa2517b656277 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
services: | |
application: | |
image: my-play-app | |
ports: | |
- "9000:9000" |
This file contains hidden or 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
# 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