From c692e2e7dcc2da511f4d1c1878846d020d9df98d Mon Sep 17 00:00:00 2001 From: "Fly.io" Date: Mon, 16 Dec 2024 04:22:08 +0000 Subject: [PATCH] New files from Fly.io Launch --- examples/react-router/.dockerignore | 6 ++++ examples/react-router/Dockerfile | 45 +++++++++++++++++++++++++++++ examples/react-router/fly.toml | 23 +++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 examples/react-router/.dockerignore create mode 100644 examples/react-router/Dockerfile create mode 100644 examples/react-router/fly.toml diff --git a/examples/react-router/.dockerignore b/examples/react-router/.dockerignore new file mode 100644 index 00000000..c08251ce --- /dev/null +++ b/examples/react-router/.dockerignore @@ -0,0 +1,6 @@ +node_modules + +/.cache +/build +.env +.react-router diff --git a/examples/react-router/Dockerfile b/examples/react-router/Dockerfile new file mode 100644 index 00000000..3eff11e3 --- /dev/null +++ b/examples/react-router/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 --include=dev + +# Copy application code +COPY . . + +# Build application +RUN npm run build + +# Remove development dependencies +RUN npm prune --omit=dev + + +# Final stage for app image +FROM base + +# Copy built application +COPY --from=build /app /app + +# Start the server by default, this can be overwritten at runtime +EXPOSE 3000 +CMD [ "npm", "run", "start" ] diff --git a/examples/react-router/fly.toml b/examples/react-router/fly.toml new file mode 100644 index 00000000..36db0c3a --- /dev/null +++ b/examples/react-router/fly.toml @@ -0,0 +1,23 @@ +# fly.toml app configuration file generated for remix-fastify on 2024-12-16T04:20:27Z +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = 'remix-fastify' +primary_region = 'iad' + +[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