Files
hub-monorepo/Dockerfile.hubble
Shane da Silva ea55abcb83 Add separate Dockerfile for dedicated public image (#962)
We want to make it easier for developers to get started with hubs.

Add a separate optimized Docker image which we'll distribute for both
AMD and ARM architectures.

For now the publishing process is manual, but once hubs are fully open
(no peering allowlists) we'll be able to auto-publish with each hubble
release on NPM.
2023-05-11 20:31:45 -07:00

48 lines
1.3 KiB
Docker

# Produces the Docker image published at farcasterxyz/hubble
#
# This assumes the Docker build context is the root of the monorepo
# (i.e. not the same as
FROM node:18.16.0-alpine3.17 as build
# Needed for compilation step
RUN apk add --no-cache libc6-compat python3 make g++ linux-headers
USER node
RUN mkdir /home/node/app
WORKDIR /home/node/app
WORKDIR /home/node/app/apps/hubble
# Don't include yarn.lock since that's for the monorepo, not Hubble specifically
COPY ./apps/hubble/package.json ./package.json
RUN yarn install --production --prefer-offline
WORKDIR /home/node/app
COPY ./tsconfig.json ./tsconfig.json
COPY ./apps/hubble/tsconfig.json ./apps/hubble/tsconfig.json
COPY ./apps/hubble/.config ./apps/hubble/.config
COPY ./apps/hubble/src ./apps/hubble/src
FROM node:18.16.0-alpine3.17 as app
# Requirement for runtime metrics integrations
RUN apk add --no-cache libc6-compat
USER node
RUN mkdir /home/node/app
WORKDIR /home/node/app
COPY --from=build /home/node/app ./
# BuildKit doesn't support the --squash flag, so we emulate it
# copying everything into a single layer.
FROM scratch
COPY --from=app / /
WORKDIR /home/node/app/apps/hubble
CMD ["yarn", "start", "--ip", "0.0.0.0", "--gossip-port", "2282", "--rpc-port", "2283", "--eth-rpc-url", "https://eth-goerli.g.alchemy.com/v2/IvjMoCKt1hT66f9OJoL_dMXypnvQYUdd", "--network", "1"]