I just tried starting from scratch with
yarn create redwood-app my-redwood-project
I added host
to my redwood.toml:
# This file contains the configuration settings for your Redwood app.
# This file is also what makes your Redwood app a Redwood app.
# If you remove it and try to run `yarn rw dev`, you'll get an error.
#
# For the full list of options, see the "App Configuration: redwood.toml" doc:
# https://redwoodjs.com/docs/app-configuration-redwood-toml
[web]
title = "Redwood App"
host = '0.0.0.0'
port = 8910
apiUrl = "/.redwood/functions" # You can customize graphql and dbauth urls individually too: see https://redwoodjs.com/docs/app-configuration-redwood-toml#api-paths
includeEnvironmentVariables = [
# Add any ENV vars that should be available to the web side to this array
# See https://redwoodjs.com/docs/environment-variables#web
]
[api]
host = '0.0.0.0'
port = 8911
[browser]
open = true
[notifications]
versionUpdates = ["latest"]
I then created a miinimal Dockerfile:
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.19.0
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime="RedwoodJS"
# Install Yarn
ARG YARN_VERSION=4.0.2
RUN corepack enable && \
yarn set version $YARN_VERSION
# Copy project
WORKDIR /my-redwood-project
COPY . .
# Build application
RUN yarn install && \
yarn rw build
# Start the server by default, this can be overwritten at runtime
EXPOSE 8910
CMD [ "yarn", "rw", "serve" ]
For the moment, you can see the result here: https://my-redwood-project.fly.dev/ (I’ll take that app down once it serves its purpose).
Clearly this is not a representative project, nor is this an complete Dockerfile, but it does work.
Now I don’t know RedwoodJS, but I do know fly.io and Node.js. What should be changed to make it more representative and exhibit the problem you are seeing?
If possible, I would like the end result of this exercise to be for me to update fly.io’s dockerfile generator to create a Dockerfile that will work for at least your application as that can be the starting point for others.