'I cannot build vitejs + vue docker-compose
I am writing here a new question, because i can't find solution of my problem. I am trying to build this for two days.
TLDR:
I am building a vue project with vite. Everything is fine, when i use npm run dev
Also, everything looks fine when i build docker-compose inside frontend directory.
I need to place docker-compose outside of this dir, cuz i would like to create more dockers like backend, nginx, postress.
Dockerfile:
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
RUN npm install -g npm
COPY package*.json ./
RUN npm install
docker-compose.yml:
version: "3.9"
services:
frontend:
build:
context: frontend/
dockerfile: Dockerfile
working_dir: /app
command: ["npm", "run", "dev"]
env_file:
- config/env/server-developer.env
environment:
- CHOKIDAR_USEPOLLING=true
volumes:
- type: volume
source: node_modules
target: /app/node_modules
ports:
- 8080:8080
volumes:
node_modules:
project build: this is project location
okey, so, when i use docker-compose -f docker-compose.yml up --build
i got this output:
Recreating project_frontend_1 ... done
Attaching to project_frontend_1
frontend_1 |
frontend_1 | > [email protected] dev
frontend_1 | > vite --host 0.0.0.0
frontend_1 |
frontend_1 | sh: vite: not found
project_frontend_1 exited with code 127
If you need more information, i will add. I know that most ppl use dockers, but i can't find solution that can help me with it. Someone said that vite is not installed globaly, i can't finde npm install comand to install as dependency in package.json.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
