I want to make dev-configuration for my Dockerized Django(+gunicorn+db)+Vue+Nginx project, where i don’t have to rebuild the frontend everytime and use vue dev server instead, specifically "vue-cli-service serve". Nginx listens on localhost:80 and will proxy "/api" requests to upstream django on port 8000 and the rest to upstream vue server on port 8080.
Docker succesfully builds 4 containters, but then vue service dies instantly. that’s what i get
Here is its Dockerfile:
FROM node:12-alpine WORKDIR /frontend COPY package*.json . RUN npm install COPY . . RUN ls -al EXPOSE 8080 CMD ["npm", "run", "serve"]
(If i use RUN instead of CMD as a final command then the server gets built and the terminal hangs after webpack welcome message, but "docker-compose ps" from another tab shows no containers are up)
Here is a part of docker-compose.yml:
frontend: build: ./frontend restart: on-failure container_name: vue expose: - 8080 volumes: - ./frontend:/home/frontend - ./.env.dev:/home/frontend/.env:ro
Source: Docker Questions