-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathDockerfile
55 lines (52 loc) · 3.05 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
FROM node:10.15.3-alpine as builder
RUN apk add --update python make g++ yarn
RUN mkdir /application
COPY package.json yarn.lock .yarnrc /application/
COPY packages-cache /application/packages-cache
WORKDIR /application
RUN mkdir /application/packages
COPY tsconfig.json /application/
COPY packages/api-cardano-db-hasura /application/packages/api-cardano-db-hasura
COPY packages/api-genesis /application/packages/api-genesis
COPY packages/server /application/packages/server
COPY packages/util /application/packages/util
COPY packages/util-dev /application/packages/util-dev
RUN yarn --offline --frozen-lockfile --non-interactive
RUN yarn build
FROM node:10.15.3-alpine as production_deps
RUN mkdir -p application/packages
COPY package.json yarn.lock .yarnrc /application/
COPY --from=builder /application/packages-cache /application/packages-cache
WORKDIR /application/packages
RUN mkdir api-cardano-db-hasura api-genesis util server
COPY packages/api-cardano-db-hasura/package.json api-cardano-db-hasura/
COPY packages/api-genesis/package.json api-genesis/
COPY packages/server/package.json server/
COPY packages/util/package.json util/
WORKDIR /application
RUN yarn --production --offline --frozen-lockfile --non-interactive
FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.30 as downloader
RUN apk add curl
RUN curl --proto '=https' --tlsv1.2 -sSf -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | sh
RUN hasura --skip-update-check update-cli --version v1.2.1
FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.30 as server
ARG NETWORK=mainnet
RUN apk add nodejs
RUN mkdir /application
COPY --from=builder /application/packages/api-cardano-db-hasura/dist /application/packages/api-cardano-db-hasura/dist
COPY --from=builder /application/packages/api-cardano-db-hasura/hasura/project /application/packages/api-cardano-db-hasura/hasura/project
COPY --from=builder /application/packages/api-cardano-db-hasura/package.json /application/packages/api-cardano-db-hasura/package.json
COPY --from=builder /application/packages/api-cardano-db-hasura/schema.graphql /application/packages/api-cardano-db-hasura/schema.graphql
COPY --from=builder /application/packages/api-genesis/dist /application/packages/api-genesis/dist
COPY --from=builder /application/packages/api-genesis/package.json /application/packages/api-genesis/package.json
COPY --from=builder /application/packages/api-genesis/schema.graphql /application/packages/api-genesis/schema.graphql
COPY --from=builder /application/packages/server/dist /application/packages/server/dist
COPY --from=builder /application/packages/server/package.json /application/packages/server/package.json
COPY --from=builder /application/packages/util/dist /application/packages/util/dist
COPY --from=builder /application/packages/util/package.json /application/packages/util/package.json
COPY --from=production_deps /application/node_modules /application/node_modules
COPY --from=downloader /usr/local/bin/hasura /usr/local/bin/hasura
COPY config/network/${NETWORK}/genesis /config/genesis/
WORKDIR /application/packages/server/dist
EXPOSE 3100
CMD ["node", "index.js"]