1
1
# Stage 1: Build the Vue.js application
2
- FROM node:14 as build-stage
2
+ FROM node:14 AS build-stage
3
+
4
+ USER node
3
5
WORKDIR /app
4
- COPY package*.json ./
6
+
7
+ COPY --chown=1000:1000 package*.json ./
5
8
RUN npm install
6
- COPY . .
9
+ COPY --chown=1000:1000 . .
7
10
# this will tokenize the app
8
11
RUN npm run build
9
12
10
13
# Stage 2: Prepare the Node.js API
11
- FROM node:14 as api-stage
14
+ FROM node:14 AS api-stage
12
15
WORKDIR /api
13
16
# Copy package.json and other necessary files for the API
14
- COPY api/package*.json ./
15
- RUN npm install
17
+ COPY --chown=1000:1000 api/package*.json ./
18
+ RUN npm install \
19
+ && chown -R 1000:1000 /api
20
+
16
21
# Copy the rest of your API source code
17
- COPY api/ .
22
+ COPY --chown=1000:1000 api/ .
18
23
19
24
# Copy the built Vue.js app from the previous stage
20
- COPY --from=build-stage /app/dist /api/public
21
- COPY --from=build-stage /app/dist/assets/app-config.js /api/app-config.template.js
25
+ COPY --chown=1000:1000 -- from=build-stage /app/dist /api/public
26
+ COPY --chown=1000:1000 -- from=build-stage /app/dist/assets/app-config.js /api/app-config.template.js
22
27
23
28
# install gettext-base for envsubst
24
29
RUN apt-get update && apt-get install -y gettext-base
@@ -28,4 +33,6 @@ EXPOSE 3000
28
33
29
34
# Command to run your API (and serve your Vue.js app)
30
35
RUN chmod +x /api/docker-entrypoint.api/entrypoint.sh
31
- ENTRYPOINT ["/api/docker-entrypoint.api/entrypoint.sh" ]
36
+
37
+ USER node
38
+ ENTRYPOINT ["/api/docker-entrypoint.api/entrypoint.sh" ]
0 commit comments