-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 851 Bytes
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 851 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
FROM node:20-alpine
# Accept build arguments for ports
ARG SERVER_PORT
ARG CLIENT_PORT
# Set them as environment variables for runtime
ENV SERVER_PORT=${SERVER_PORT}
ENV CLIENT_PORT=${CLIENT_PORT}
# Create work directory and set owner to node user
RUN mkdir -p /app/inscript && chown -R node:node /app
# Set working directory
WORKDIR /app/inscript
# Install system dependencies
RUN apk add --no-cache git openssh-client
# Switch to the node user (UID 1000)
USER node
# Configure Git to trust the /app directory (needed for Docker mounts)
RUN git config --global --add safe.directory /app
# Install dependencies
COPY --chown=node:node package*.json ./
RUN npm install
# Copy source code
COPY --chown=node:node . .
# Expose ports (documented)
EXPOSE ${SERVER_PORT}
EXPOSE ${CLIENT_PORT}
# Run the development server
CMD ["npm", "run", "dev"]