From 7cb6349ac7cf745d2dae6d1e3e7fe1901c20d222 Mon Sep 17 00:00:00 2001 From: Guntis Smaukstelis Date: Fri, 12 May 2023 23:57:04 +0300 Subject: [PATCH] Configure fly.io and docker --- .dockerignore | 34 ++++++++++++++++++++++++++++++ Dockerfile | 7 ++++++ fly.toml | 13 ++++++++++++ src/main/scala/server/Server.scala | 2 +- web/index.html | 10 +++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 fly.toml create mode 100644 web/index.html diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3f05981 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,34 @@ +# flyctl launch added from .gitignore +**/src/main/resources/application.conf + +**/project/target +**/project/project/target +**/.bsp +**/.project +**/.classpath +**/.cache +**/.settings +**/dist/* +**/lib_managed +**/ivy +**/ivy-cache +**/dependency-reduced-pom.xml +**/.history +**/.idea +**/*.iml +**/*.ipr +**/*.iws +.idea_modules +**/*.swp +**/*.swo +**/*.log +**/logs +**/.DS_Store +**/data/* +!**/project/assembly.sbt + +# flyctl launch added from .idea/.gitignore +# Default ignored files +.idea/shelf +.idea/workspace.xml +fly.toml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5f95541 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM amazoncorretto:17-alpine + +COPY ./data /data +COPY ./web /web +COPY ./target/scala-2.13/WeatherTool-assembly-0.1.1-SNAPSHOT.jar /app.jar + +CMD ["java", "-jar", "/app.jar"] \ No newline at end of file diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..173f633 --- /dev/null +++ b/fly.toml @@ -0,0 +1,13 @@ +# fly.toml app configuration file generated for weather-tool on 2023-05-12T22:54:40+03:00 +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = "weather-tool" +primary_region = "waw" + +[http_service] + internal_port = 8080 + force_https = true + auto_stop_machines = true + auto_start_machines = true diff --git a/src/main/scala/server/Server.scala b/src/main/scala/server/Server.scala index 9523600..1256c32 100644 --- a/src/main/scala/server/Server.scala +++ b/src/main/scala/server/Server.scala @@ -86,7 +86,7 @@ object Server extends IOApp { override def run(args: List[String]): IO[ExitCode] = BlazeServerBuilder[IO] - .bindHttp(3000, "localhost") + .bindHttp(8080, "0.0.0.0") .withHttpApp(httpApp) .serve .compile diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..c37fb73 --- /dev/null +++ b/web/index.html @@ -0,0 +1,10 @@ + + + + + WeatherTool + + +

Hello, Weather!

+ + \ No newline at end of file