forked from ruxailab/RUXAILAB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (27 loc) · 829 Bytes
/
Dockerfile
File metadata and controls
41 lines (27 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM node:20.18-alpine AS build-stage
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY babel.config.js ./
COPY vue.config.js ./
COPY .env ./
COPY public ./public
COPY src ./src
# Run build as per the script defined in package.json
RUN npm run build-dev
# Production stage using a minimal Node.js image
FROM node:20.18-alpine AS production-stage
# Install 'serve' to serve the application
RUN npm install -g serve
WORKDIR /app
# Run as a non-root user in production
RUN addgroup -S app && adduser -S app -G app
# Copy WITHOUT --chown first
COPY --from=build-stage /app/dist /app
# Then chown AND chmod in same layer
RUN chown -R app:app /app && chmod -R 555 /app
# Expose the port that 'serve' will run on
EXPOSE 5000
USER app
# Command to serve the application on port 5000
CMD ["serve", "-s", ".", "-l", "5000"]