What is it about:
I currently need to learn how Docker works and therefore I started working on a small project. I have a VueJs Frontend (something pretty basic) and a python API (pretty Basic as well). I managed to create a Docker Volume with 2 containers (1 for the vuejs, 1 for the py API).
The problem:
After making the docker containers (both worked) I started working on the VueJs project and nearly finished it now. The problem is, when I try to create a new Image (with that updated vuejs project), and create a new container with that new Image, I always get the default VueJs page when opening the project. It then looks like nothing updated on the vuejs project but it acutally did.
VueJs: Dockerfile
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
COPY package-lock.json ./
RUN npm install
COPY . .
RUN npm run build
#After npm run build successful, publish to nginx:
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
docker-compose.yml
version: "3.9"
volumes:
M210-Project-Youtas-v0.2:
services:
vue-nginx:
image: vuejs/youtas-v0.2
volumes:
- M210-Project-Youtas-v0.2:/etc/nginx/templates
ports:
- "8080:80"
environment:
- NGINX_PORT=80
pythonflask-api:
image: pythonflaskapi/youtas-v0.2
volumes:
- M210-Project-Youtas-v0.2:/etc/flask/templates
ports:
- "5000:5000"
environment:
- DEBUG=1
What I tried
I ran this command to make sure vue builds the latest changes to production version:
npm run build
I tried deleting the old containers,images and volumes.
I tired to change the volume name
UPDATE
I restarted my computer and now I can see the changes I've made to the vuejs project when connecting to the docker container. But that can not be the only way of doing this.
vue-nginx: image: vuejs/youtas-v0.2according to the NEW image you have created?