-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (35 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
48 lines (35 loc) · 1.14 KB
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
42
43
44
45
46
47
48
FROM docker.io/library/node:25
USER root
# Pull Debian security fixes (addresses libpng/libpq/linux-libc-dev CVEs when available in node security)
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container
WORKDIR /usr/src/app
# Upgrade npm to latest package version
RUN npm install -g npm@11.7.0
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code to the working directory
COPY . .
# Build the Vue.js application
RUN npm run build
# REMOVE build-time dependencies
RUN rm -rf node_modules
# Install serve globally *before* switching user
RUN npm install -g serve
# Expose the port the app runs on
EXPOSE 3000
# Add non root user
ARG USER=intelmicroserviceuser
ARG UID=1999
RUN useradd -ms /bin/bash ${USER} -o -u $UID && \
chown ${USER}:${USER} -R /usr/src/app /root
RUN mkdir -p /home/${USER}/ && chown -R ${USER}:${USER} /home/${USER}
USER ${USER}
# Serve built static files
CMD ["serve", "-s", "dist", "-l", "3000"]