-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (41 loc) · 1.03 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#### BUILD IMAGE ####
FROM node:9-alpine AS Build
ARG NODE_ENV
# Enables color output
ENV FORCE_COLOR=true \
TERM=xterm \
CI=true
# Create app directory
WORKDIR /usr/src/app/
COPY ./package.json ./
COPY ./package-lock.json ./
# Install dependencies
RUN npm i --quiet
# Copy over the application
COPY . ./
# Linting
RUN npm run lint
# Tests
RUN npm run test
# Compile React application
RUN npm run build
# Remove dev modules
RUN npm prune --production
#### RUNTIME IMAGE ####
FROM node:9-alpine AS Runtime
# Run under node user to lockdown permissions
USER node
WORKDIR /usr/src/app/
# Copy built modules
COPY --from=Build /usr/src/app/node_modules/ ./node_modules
# Copy files
COPY ./database.json ./
COPY ./package.json ./
# Copy application directories
COPY ./migrations ./migrations
COPY --from=Build /usr/src/app/client ./client
COPY --from=Build /usr/src/app/service ./service
COPY --from=Build /usr/src/app/.build ./.next
COPY --from=Build /usr/src/app/.build ./.build
# Ready to go
CMD [ "node", "./service/start.js" ]