-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathrailway.indexer.Dockerfile
78 lines (58 loc) · 1.79 KB
/
railway.indexer.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Use a Node.js base image
FROM node:20-alpine AS base
# Set the working directory inside the container
WORKDIR /app
ARG DATABASE_URL
ARG INDEXER_DATABASE_URL
ARG APP_ENV
ARG APP_PORT
ARG NETWORK
ARG DNA_TOKEN
ARG DNA_CLIENT_URL
RUN echo ${DATABASE_URL}
RUN echo ${INDEXER_DATABASE_URL}
RUN echo ${APP_ENV}
RUN echo ${APP_PORT}
RUN echo ${TELEGRAM_WEB_APP}
RUN echo ${NETWORK}
RUN echo ${DNA_TOKEN}
RUN echo ${DNA_CLIENT_URL}
RUN apk add --no-cache \
openssl \
libc6-compat
# openssl1.1-compat
# Copy root-level package files
COPY package.json pnpm-workspace.yaml ./
# Install pnpm globally
RUN npm install -g pnpm
RUN apk add --no-cache openssl
# Copy the entire repository into the Docker container
COPY . .
# RUN apk add --no-cache openssl
# Install all dependencies for the workspace
RUN pnpm install --force
#RUN pnpm run build:indexer-prisma
#RUN pnpm --filter indexer-prisma build
# Build nestjs-indexer
RUN pnpm --filter nestjs-indexer build:all
# Use a smaller production base image
FROM node:20-alpine AS production
# Install necessary dependencies in production
RUN apk add --no-cache \
openssl \
libc6-compat
# Set the working directory in the production container
WORKDIR /app
# Copy the node_modules and built files from the base stage
COPY --from=base /app/node_modules ./node_modules
COPY --from=base /app/packages/common ./packages/common
COPY --from=base /app/packages/indexer-prisma ./packages/indexer-prisma
COPY --from=base /app/apps/nestjs-indexer/dist ./apps/nestjs-indexer/dist
# Copy only necessary files for the application to run
COPY apps/nestjs-indexer/package.json ./
# Set the environment variable to production
ENV NODE_ENV=production
# Expose the port your app runs on
EXPOSE 3000
# Command to start the application
CMD ["node", "apps/nestjs-indexer/dist/main"]