This might have to go to the Remix forums instead, posting here for quick reference in case anyone searches. When creating a Remix app and choosing Fly.io as the deployment method, the default fly.toml sets the internal_port = 8080
, while Remix apps start by default on port 3000. Needs to be changed to internal_port = 3000
to successfully deploy.
2 Likes
Alternately, the Dockerfile or fly.toml could set the PORT
environment variable.
From my experience and after confirming it by checking the flyctl code, they already set port 8080 inside .env file
Oh, interesting. On an app created and launched with create-remix
latest and flyctl
latest I don’t have a .env
file, and remix.env.d.ts
is empty other than typescript references. No mention of loading any local env vars in the default Dockerfile
either:
# base node image
FROM node:16-bullseye-slim as base
# Install openssl for Prisma
RUN apt-get update && apt-get install -y openssl
# Install all node_modules, including dev dependencies
FROM base as deps
RUN mkdir /app
WORKDIR /app
ADD package.json package-lock.json ./
RUN npm install --production=false
# Setup production node_modules
FROM base as production-deps
RUN mkdir /app
WORKDIR /app
COPY --from=deps /app/node_modules /app/node_modules
ADD package.json package-lock.json ./
RUN npm prune --production
# Build the app
FROM base as build
ENV NODE_ENV=production
RUN mkdir /app
WORKDIR /app
COPY --from=deps /app/node_modules /app/node_modules
# If we're using Prisma, uncomment to cache the prisma schema
# ADD prisma .
# RUN npx prisma generate
ADD . .
RUN npm run build
# Finally, build the production image with minimal footprint
FROM base
ENV NODE_ENV=production
RUN mkdir /app
WORKDIR /app
COPY --from=production-deps /app/node_modules /app/node_modules
# Uncomment if using Prisma
# COPY --from=build /app/node_modules/.prisma /app/node_modules/.prisma
COPY --from=build /app/build /app/build
COPY --from=build /app/public /app/public
ADD . .
CMD ["npm", "run", "start"]
OK I’ve added it so that it will be in the next version of flyctl:
1 Like