-
Notifications
You must be signed in to change notification settings - Fork 43
/
Dockerfile
49 lines (38 loc) · 1.26 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
FROM node:10-alpine as build-stage
WORKDIR /app
# install build dependencies
RUN apk add --no-cache \
git
# install application dependencies
COPY package.json yarn.lock ./
RUN JOBS=max yarn install --non-interactive --frozen-lockfile
# copy in application source
COPY . .
# run tests and compile sources
RUN yarn test
# set node env for webpack build
ENV NODE_ENV production
# build webpack bundle
RUN yarn build
# prune modules
RUN yarn install --non-interactive --frozen-lockfile --production
# copy built application to runtime image
FROM node:10-alpine
WORKDIR /app
COPY --from=build-stage /app/app.js app.js
COPY --from=build-stage /app/constants.js constants.js
COPY --from=build-stage /app/bad-domains.js bad-domains.js
COPY --from=build-stage /app/bin bin
COPY --from=build-stage /app/countries.json countries.json
COPY --from=build-stage /app/db db
COPY --from=build-stage /app/GeoIP2-Country.mmdb GeoIP2-Country.mmdb
COPY --from=build-stage /app/helpers helpers
COPY --from=build-stage /app/node_modules node_modules
COPY --from=build-stage /app/public public
COPY --from=build-stage /app/routes routes
COPY --from=build-stage /app/src src
COPY --from=build-stage /app/views views
# run on port 3001
ENV NODE_ENV production
ENV PORT 3001
CMD [ "node", "bin/www" ]