-
Notifications
You must be signed in to change notification settings - Fork 267
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (27 loc) · 834 Bytes
/
Dockerfile
File metadata and controls
39 lines (27 loc) · 834 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
FROM node:20
# Create app directory
WORKDIR /usr/src/app
# Install git (needed for submodules)
RUN apt-get update && apt-get install -y git
# Create a non-root user
RUN useradd -m -u 2000 nodeuser
# Copy package files first for better caching
COPY package*.json ./
# Install dependencies
RUN npm install
# Bundle app source
COPY . .
# Initialize and update git submodules
RUN git init
RUN git submodule init
RUN git submodule update
# Run the update-browserslist-db as suggested in the warning
RUN npx update-browserslist-db@latest
# Change ownership of the app directory to the non-root user
RUN chown -R nodeuser:nodeuser /usr/src/app
# Switch to non-root user
USER nodeuser
# Configure git to trust the mounted directory
RUN git config --global --add safe.directory /usr/src/app
EXPOSE 8080
CMD [ "npm", "run", "dev" ]