-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
executable file
·68 lines (52 loc) · 1.32 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
59
60
61
62
63
64
65
66
FROM node:11 as base
WORKDIR app
COPY package.json package.json
COPY yarn.lock yarn.lock
COPY .eslintignore .eslintignore
COPY .eslintrc .eslintrc
COPY tsconfig.test.json tsconfig.test.json
COPY tsconfig.json tsconfig.json
COPY src src
COPY example/src example/src
COPY example/now.json example/now.json
COPY example/package.json example/package.json
COPY example/yarn.lock example/yarn.lock
COPY example/tsconfig.json example/tsconfig.json
COPY example/next-env.d.ts example/next-env.d.ts
RUN yarn install
########
# Lint #
########
FROM base as lint
CMD ["yarn", "lint"]
########
# Test #
########
FROM base as test
CMD ["yarn", "test"]
###########
# Publish #
###########
FROM base as publish
RUN yarn build-package
ARG NPM_TOKEN
ENV NPM_TOKEN=$NPM_TOKEN
RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
CMD ["npm", "publish", "--access", "public"]
#################
# Deploy Static #
#################
FROM base as deploy-static
RUN yarn global add [email protected]
ARG NOW_TOKEN
ENV NOW_TOKEN=$NOW_TOKEN
CMD now --token $NOW_TOKEN -A now-static.json --prod
###############
# Deploy Docs #
###############
FROM base as deploy-docs
RUN yarn global add [email protected]
RUN yarn install-example && yarn build-example && yarn export-example
ARG NOW_TOKEN
ENV NOW_TOKEN=$NOW_TOKEN
CMD cd example && now --token $NOW_TOKEN --prod