forked from matter-labs/block-explorer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
42 lines (33 loc) · 957 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM node:22-slim AS build
RUN apt-get update && apt-get install -y python3 make g++
WORKDIR /app
# Copy config files to install dependencies
COPY .npmrc .npmrc
COPY lerna.json .
COPY package.json .
COPY packages/api/package.json ./packages/api/package.json
COPY yarn.lock .
# Install all dependencies and build
RUN yarn install --production=false
COPY packages/api/ ./packages/api/
RUN yarn build
FROM node:22-slim
WORKDIR /app
# Copy all files. Package is copied entire from build phase
COPY .npmrc .npmrc
COPY lerna.json .
COPY package.json .
COPY packages/api ./packages/api
COPY --from=build /app/packages/api/dist ./packages/api/dist
COPY yarn.lock .
# Install only prod dependencies
RUN yarn install --production=true
ARG NODE_ENV=production
ENV NODE_ENV=$NODE_ENV
ARG PORT=3000
ENV PORT=$PORT
ARG METRICS_PORT=3005
ENV METRICS_PORT=$METRICS_PORT
EXPOSE $PORT $METRICS_PORT 9229 9230
WORKDIR /app/packages/api
CMD [ "node", "dist/main.js" ]