forked from ChainSafe/lodestar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
27 lines (20 loc) · 909 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
FROM node:14-alpine as base
WORKDIR /usr/app
RUN apk update && apk add --no-cache git g++ make python && rm -rf /var/cache/apk/*
FROM base as development
RUN apk add --no-cache bash
RUN yarn global add ts-node typescript
FROM base as build
# Installs all deps in the root yarn.lock, which are most of them. To cache before copying the src
COPY package.json yarn.lock ./
RUN yarn install --non-interactive --frozen-lockfile --ignore-scripts
COPY . .
RUN yarn install --non-interactive --frozen-lockfile
RUN node ./scripts/getGitData /usr/app/.git-data.json
# Copy built src + node_modules to a new layer to prune unnecessary fs
# Previous layer weights 7.25GB, while this final 488MB (as of Oct 2020)
FROM node:14-alpine as production
WORKDIR /usr/app
COPY --from=build /usr/app .
ENV DOCKER_LODESTAR_GIT_DATA_FILEPATH /usr/app/.git-data.json
ENTRYPOINT ["node", "./packages/lodestar-cli/bin/lodestar"]