I’m new to Docker and Remix and having problems figuring out how to deploy Remix on Docker.
When I build the Docker it stops at RUN npm run build
and gives this error
> build
> remix vite:build
sh: 1: remix: not found
My docker file
FROM node:20-bullseye-slim
RUN apt-get update && apt-get install -y openssl sqlite3
WORKDIR /app
COPY package.json ./
RUN npm install --omit=dev
RUN npx prisma generate
COPY . .
RUN npm run build
EXPOSE 3000
ENV DATABASE_URL=file:./dev.db
ENV PORT=3000
ENV NODE_ENV=production
CMD [ "npm", "run", "start" ]
My package.json
{
"name": "film-ranking",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix vite:build",
"dev": "remix vite:dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "remix-serve ./build/server/index.js",
"typecheck": "tsc"
},
"dependencies": {
"@picocss/pico": "^2.0.6",
"@prisma/client": "^5.15.0",
"@remix-run/node": "^2.9.2",
"@remix-run/react": "^2.9.2",
"@remix-run/serve": "^2.9.2",
"bcrypt": "^5.1.1",
"isbot": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.2.1",
"remix": "^2.10.3"
},
"devDependencies": {
"@remix-run/dev": "^2.9.2",
"@types/bcrypt": "^5.0.2",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.38.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prisma": "^5.15.0",
"typescript": "^5.1.6",
"vite": "^5.1.0",
"vite-tsconfig-paths": "^4.2.1"
},
"engines": {
"node": ">=20.0.0"
}
}
I have tried adding npm install remix
and it solved the issue but it says that it is deprecate so I would like to use a different solution.
I appreciate any help you can provide. Thanks.