Reputation: 31
i create this docker-compose for my project (dev only) but for no particular reason on every OS the volume for ./back:/app and ./front:/app don't work (the other volumes work)
services:
backend:
build: ./back
container_name: backend
volumes:
- ./back:/app
ports:
- "8080:8080"
depends_on:
- db
networks:
- back
frontend:
build: ./front
container_name: frontend
volumes:
- ./front:/app
- /app/node_modules
ports:
- "8900:5173"
depends_on:
- backend
db:
image: mysql:latest
container_name: mysql_db
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: gatekeeper
MYSQL_USER: user
MYSQL_PASSWORD: password
ports:
- "3308:3306"
volumes:
- mysql_data:/var/lib/mysql
networks:
- back
volumes:
mysql_data:
networks:
back:
detailled dockerfile for front and back front :
FROM node:latest
WORKDIR /app
COPY package*.json ./
RUN npm install -g vite
RUN npm install
COPY . .
EXPOSE 5173
CMD ["npm", "run", "dev"]
back:
FROM sapmachine:17
WORKDIR /app
COPY mvnw .
RUN chmod +x mvnw
COPY .mvn .mvn
COPY pom.xml .
RUN ./mvnw dependency:go-offline
COPY src ./src
EXPOSE 8080
CMD ["./mvnw", "spring-boot:run"]
actually the project build without any problem just the update of file from the computer to the docker don't work .
Upvotes: 0
Views: 22