-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
51 lines (38 loc) · 1.28 KB
/
Dockerfile
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
49
50
51
# First Stage: Build Environment
FROM ubuntu:22.04 as builder
# Set non-interactive installation to avoid prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
# Update package lists and install git, Node.js, and npm
RUN apt-get update && \
apt-get install -y git nodejs npm && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Clone the repository to the working directory using the default branch
ARG REPO_URL=https://github.com/eclipse-oniro4openharmony/f-oh-data
RUN git clone ${REPO_URL} .
COPY allAppList.json /app/allAppList.json
COPY data/ /app/data/
# Install application dependencies
RUN npm install
# -------------------------------------------------------
# Second Stage: Production Environment
FROM ubuntu:22.04
# Set non-interactive installation
ENV DEBIAN_FRONTEND=noninteractive
# Install Node.js and npm
RUN apt-get update && \
apt-get install -y nodejs npm && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy Node.js dependencies from the builder stage
COPY --from=builder /app/node_modules /app/node_modules
# Copy application code and other necessary files
COPY --from=builder /app /app
# Expose port 5000
EXPOSE 5000
# Start the application
CMD ["npm", "start"]