From 12f829e1ce312ac0b4859976a3f33c06e97074c3 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Thu, 16 Mar 2023 15:27:49 +0100 Subject: [PATCH] add fly conf --- .dockerignore | 4 ++++ Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ fly.toml | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 fly.toml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..79297ed --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +Dockerfile +.dockerignore +node_modules +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..93c789a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +FROM debian:bullseye as builder + +ARG NODE_VERSION=19.7.0 + +RUN apt-get update; apt install -y curl +RUN curl https://get.volta.sh | bash +ENV VOLTA_HOME /root/.volta +ENV PATH /root/.volta/bin:$PATH +RUN volta install node@${NODE_VERSION} + +####################################################################### + +RUN mkdir /app +WORKDIR /app + +# NPM will not install any package listed in "devDependencies" when NODE_ENV is set to "production", +# to install all modules: "npm install --production=false". +# Ref: https://docs.npmjs.com/cli/v9/commands/npm-install#description + +ENV NODE_ENV production + +COPY . . + +RUN npm install +FROM debian:bullseye + +LABEL fly_launch_runtime="nodejs" + +COPY --from=builder /root/.volta /root/.volta +COPY --from=builder /app /app + +WORKDIR /app +ENV NODE_ENV production +ENV PATH /root/.volta/bin:$PATH +ENV PORT 8080 + +CMD [ "npm", "run", "start" ] diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..1aec153 --- /dev/null +++ b/fly.toml @@ -0,0 +1,37 @@ +# fly.toml file generated for y-webrtc-eu on 2023-03-16T15:02:47+01:00 + +app = "y-webrtc-eu" +kill_signal = "SIGINT" +kill_timeout = 5 +processes = [] + +[env] + +[experimental] + auto_rollback = true + +[[services]] + http_checks = [] + internal_port = 8080 + processes = ["app"] + protocol = "tcp" + script_checks = [] + [services.concurrency] + hard_limit = 25 + soft_limit = 20 + type = "connections" + + [[services.ports]] + force_https = true + handlers = ["http"] + port = 80 + + [[services.ports]] + handlers = ["tls", "http"] + port = 443 + + [[services.tcp_checks]] + grace_period = "1s" + interval = "15s" + restart_limit = 0 + timeout = "2s"