I’m trying to make a dockerized Vue application work in production behind an nginx. Everything worked just fine in pre(npm run serve), but apparently build is working, and creating the dist folder, but then, when i get into the docker, dist is not there, and i think it might have somrething to do with my docker-compose volumes.
This is my Dockerfile:
# base image FROM node:12.2.0-alpine RUN apk add --no-cache bash # set working directory WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm install -g serve # start app RUN npm run build RUN ls -isla
The ls is to make sure the folder is being created (which it is).
And this is my docker-compose:
services: web: build: context: ./app dockerfile: Dockerfile volumes: - ./app/:/app/ command: serve -s dist -l 8080 env_file: - ./app/.env networks: - my-network ports: - 8080:8080
Any idea what Am I doing wrong? (super Vue and docker-compose noob here)
node_modules is also empty in the container, which i find also weird.
Source: Docker Questions