Files
lodestar/docker/from_source.Dockerfile
Lion - dapplion 15d8ae2c2c Simplify gitData and version guessing (#3992)
Don't print double slash in version string

Dont add git-data.json to NPM releases

Write git-data.json only in from source docker build

Remove numCommits

Test git-data.json generation from within the test

Move comment

Revert "Dont add git-data.json to NPM releases"

This reverts commit 5fe2d388825f3e3a834058478071e8364b0d761c.

Simplify gitData and version guessing

Run cmd
2022-05-10 12:07:27 +02:00

51 lines
1.6 KiB
Docker

#######################
#
# To build from source:
#
# Edit root docker-compose.yml
# ```yaml
# services:
# beacon_node:
# build:
# context: .
# dockerfile: docker/from_source.Dockerfile
# ```
#
# If you need to see the commit and branch in logs + metrics,
# comment this line from .dockerignore
# ```
# .git
# ```
#
#######################
FROM node:16-alpine as build
WORKDIR /usr/app
RUN apk update && apk add --no-cache g++ make python3 && rm -rf /var/cache/apk/*
# 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 && yarn build
# To have access to the specific branch and commit used to build this source,
# a git-data.json file is created by persisting git data at build time. Then,
# a version string like `v0.35.0-beta.0/HEAD/82219149 (git)` can be shown in
# the terminal and in the logs; which is very useful to track tests better.
RUN cd packages/cli && yarn write-git-data
# 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:16-alpine
WORKDIR /usr/app
COPY --from=build /usr/app .
# NodeJS applications have a default memory limit of 2.5GB.
# This limit is bit tight for a Prater node, it is recommended to raise the limit
# since memory may spike during certain network conditions.
ENV NODE_OPTIONS=--max-old-space-size=4096
ENTRYPOINT ["node", "./packages/cli/bin/lodestar"]