diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..74340d4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +/.git +/node_modules +.dockerignore +.env +Dockerfile +fly.toml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bc6899b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +# syntax = docker/dockerfile:1 + +# Adjust NODE_VERSION as desired +ARG NODE_VERSION=20.18.0 +FROM node:${NODE_VERSION}-slim AS base + +LABEL fly_launch_runtime="Node.js" + +# Node.js app lives here +WORKDIR /app + +# Set production environment +ENV NODE_ENV="production" + + +# Throw-away build stage to reduce size of final image +FROM base AS build + +# Install packages needed to build node modules +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3 + +# Install node modules +COPY package.json ./ +RUN npm install + +# Copy application code +COPY . . + + +# Final stage for app image +FROM base + +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y chromium chromium-sandbox && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives + +# Copy built application +COPY --from=build /app /app + +# Start the server by default, this can be overwritten at runtime +EXPOSE 3000 +ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium" +CMD [ "node", "index.js" ] diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..d223509 --- /dev/null +++ b/fly.toml @@ -0,0 +1,23 @@ +# fly.toml app configuration file generated for flylogapi on 2025-07-28T05:49:03Z +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = 'flylogapi' +primary_region = 'gru' + +[build] + +[http_service] + internal_port = 3000 + force_https = true + auto_stop_machines = 'stop' + auto_start_machines = true + min_machines_running = 0 + processes = ['app'] + +[[vm]] + memory = '1gb' + cpu_kind = 'shared' + cpus = 1 + memory_mb = 1024