-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 751 Bytes
/
Dockerfile
File metadata and controls
34 lines (24 loc) · 751 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
# Base image
FROM alpine:3.7
# Update system and install dependencies (make gcc g++ and python are the equivalent for the build-essential package in the previous Dockerfile)
RUN apk update && \
apk add nodejs make gcc g++ python
# Create and define work directory
WORKDIR /code
# Copy required files
COPY ./ /code
# Install required npm packages
RUN npm set progress=false && \
npm install --silent
# Build application
RUN npm run build
# Create dedicated user to not run the application as root (security best practice)
RUN adduser -D -h /code -u 5000 myuser && \
chown -R myuser:myuser /code
USER myuser
# Expose application port
EXPOSE 8080
# Define entrypoint
ENTRYPOINT ["npm", "run"]
# Define default command
CMD ["start"]