Remix is a full stack web framework that lets you focus on the user interface and work back through web standards to deliver a fast, slick, and resilient user experience. In this article, we are going to deploy a Remix application to Valyent.
Let’s add a Dockerfile so that Valyent can build a Docker image for your application.
Copy
touch Dockerfile
We can fill it this way :
Copy
# Adjust NODE_VERSION as desiredARG NODE_VERSION=21.5.0FROM node:${NODE_VERSION}-slim as base# Remix app lives hereWORKDIR /app# Set production environmentENV NODE_ENV="production"# Throw-away build stage to reduce size of final imageFROM base as build# Install packages needed to build node modulesRUN apt-get update -qq && \ apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3# Install node modulesCOPY --link package-lock.json package.json ./RUN npm ci --include=dev# Copy application codeCOPY --link . .# Build applicationRUN npm run build# Remove development dependenciesRUN npm prune --omit=dev# Final stage for app imageFROM base# Copy built applicationCOPY --from=build /app /app# Start the server by default, this can be overwritten at runtimeEXPOSE 3000CMD [ "npm", "run", "start" ]