-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (31 loc) · 988 Bytes
/
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
# #############################################################################
# Builder
# #############################################################################
FROM node:12 AS builder
# Setup the working directory
WORKDIR /usr/src/app
COPY package*.json ./
# Install dependencies
RUN npm install
COPY . .
# Build the application
ENV NODE_ENV production
RUN npm run build
# #############################################################################
# Runner
# #############################################################################
FROM node:alpine
# Create a new user... don't run as root
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
# Setup the working directory
WORKDIR /usr/src/app
COPY package.json ./
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/build ./build
# Set app configuration
ENV PORT 5000
ENV NODE_ENV production
EXPOSE 5000
# Start the application
CMD [ "npm", "start" ]