forked from sugarlabs/musicblocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
40 lines (27 loc) · 655 Bytes
/
dockerfile
File metadata and controls
40 lines (27 loc) · 655 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
# First stage: Build stage
FROM node:18-slim AS build
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm install
# Copy source code
COPY . .
# Run linting and tests
RUN npm run lint
RUN npm run test
# Second stage: Production stage
FROM node:18-slim
WORKDIR /app
# Create non-root user
RUN useradd -m appuser
# Copy package files and install production dependencies
COPY package*.json ./
RUN npm install --production
# Copy application files
COPY --from=build /app /app
# Set proper permissions
RUN chown -R appuser:appuser /app
USER appuser
EXPOSE 3000
# Use the serve script which uses http-server
CMD ["npm", "run", "serve"]