ViteとrailsAPIのdockerで構築したアプリをherokuにデプロイする方法
解決したいこと
railsAPIの方はherokuにpushして無事に動いてますがviteの方もherokuにpushしたいです。
該当するソースコード
heroku.yml
setup:
config:
NODE_ENV: production
NPM_CONFIG_PRODUCTION: false
build:
docker:
web: Dockerfile
run:
web: npm start
package.json
{
"name": "front",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite --host",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"start": "node server.js"
},
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.10",
"@mui/lab": "^5.0.0-alpha.165",
"@mui/material": "^5.15.10",
"axios": "^1.6.7",
"axios-case-converter": "^1.1.1",
"bootstrap": "^5.3.3",
"express": "^4.18.3",
"js-cookie": "^3.0.5",
"react": "^18.2.0",
"react-bootstrap": "^2.10.1",
"react-dom": "^18.2.0",
"react-hook-form": "^7.50.1",
"react-router-dom": "^6.22.1",
"styled-components": "^6.1.8"
},
"devDependencies": {
"@types/react": "^18.2.56",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@vitejs/plugin-react": "^4.2.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"serve": "^14.2.1",
"typescript": "^5.2.2",
"vite": "^5.1.4"
}
}
command
frontend % heroku config
=== rails-react-frontend-blog Config Vars
VITE_APP_API_URL: https://rails-react-backend-blog-61422de61130.herokuapp.com/
0