29 lines
668 B
Docker
29 lines
668 B
Docker
# Use a base image with Java and Scala, including SBT
|
|
FROM hseeberger/scala-sbt:17.0.2_1.6.2_2.13.8 as build
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Copy project files to the Docker image
|
|
COPY . /app
|
|
|
|
# Compile the application
|
|
RUN sbt clean assembly
|
|
|
|
# Use a smaller base image for the final image
|
|
FROM amazoncorretto:17-alpine
|
|
|
|
# Copy the compiled JAR from the build stage
|
|
COPY --from=build /app/target/scala-2.13/WeatherTool-assembly-0.1.1-SNAPSHOT.jar /app.jar
|
|
|
|
# Define the volume to persist data
|
|
VOLUME /data
|
|
|
|
# Command to run the application
|
|
CMD ["java", "-jar", "/app.jar"]
|
|
|
|
|
|
|
|
|
|
# docker build -t scala-app .
|
|
# docker run -v /local/data/path:/data scala-app |