@@ -38,7 +38,7 @@ Create a file named `Dockerfile.dev` in your project root with the following con
3838# =========================================
3939# Stage 1: Develop the Vue.js Application
4040# =========================================
41- ARG NODE_VERSION=22.14 .0-alpine
41+ ARG NODE_VERSION=23.11 .0-alpine
4242
4343# Use a lightweight Node.js image for development
4444FROM node:${NODE_VERSION} AS dev
@@ -58,11 +58,18 @@ RUN --mount=type=cache,target=/root/.npm npm install
5858# Copy the rest of the application source code into the container
5959COPY . .
6060
61+ # Change ownership of the application directory to the node user
62+ RUN chown -R node:node /app
63+
64+ # Switch to the node user
65+ USER node
66+
6167# Expose the port used by the Vite development server
6268EXPOSE 5173
6369
6470# Use a default command, can be overridden in Docker compose.yml file
6571CMD [ "npm" , "run" , "dev" , "--" , "--host" ]
72+
6673```
6774
6875This file sets up a lightweight development environment for your Vue.js application using the dev server.
@@ -92,10 +99,13 @@ services:
9299 develop :
93100 watch :
94101 - path : ./src
102+ target : /app/src
95103 action : sync
96104 - path : ./package.json
105+ target : /app/package.json
97106 action : restart
98107 - path : ./vite.config.js
108+ target : /app/vite.config.js
99109 action : restart
100110` ` `
101111- The ` vuejs-prod` service builds and serves your static production app using Nginx.
0 commit comments