-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDockerfile
100 lines (67 loc) · 2.4 KB
/
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# This Dockerfile is used for builds on Railway. For all other purposes, use the generic `Dockerfile.dockerhub` in root dir.
FROM node:22
ENV NODE_ENV=production
# Usually, DO NOT set these in the Dockerfile. This is only for building the image in Railway.
ARG CODEGEN_GQL_URL
ARG GQL_ACCESS_TOKEN
# Pass robots-allow.txt to serve a permissive robots.txt file
ARG ROBOTS_FILE=robots-disallow.txt
ARG PUBLIC_PINATA_GATEWAY_URL
ARG INFURA_KEY
ARG ALCHEMY_KEY
ARG FILECOIN_KEY
ARG PINATA_SDK_KEY
ARG PINATA_SDK_SECRET
ARG TENDERLY_USER
ARG TENDERLY_PROJECT
ARG TENDERLY_ACCESS_SECRET
ARG GELATO_API_KEY
ARG PUBLIC_NETWORK
ARG COINMARKETCAP_API_KEY
ARG GITHUB_PERSONAL_ACCESS_TOKEN
ARG ETHERSCAN_API_KEY
ARG GQL_URL
ARG GQL_ACCESS_TOKEN
ARG CODEGEN_GQL_URL
ARG CACHE_REDIS_CONNECTION_STRING
ARG PUBLIC_BASE_URL
ARG MULTIPLAYER_API_URL
ARG MULTIPLAYER_API_ACCESS_TOKEN
ARG MEILISEARCH_HOST
ARG MEILISEARCH_API_KEY
ARG FILECOIN_BLOCKSCOUT_API_KEY
ARG OPTIMISM_BLOCKSCOUT_API_KEY
WORKDIR /app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
ARG PUBLIC_USE_LOCAL_TESTNET_WALLET_STORE
ARG PUBLIC_SUPPRESS_MISSING_VAR_IN_PROD_ERRORS
ARG LOCAL_TESTNET_RPC_URL
ARG FAKE_PINATA_URL
RUN apt-get update \
&& apt-get install -y chromium \
fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends
# Install necessary dependencies for Puppeteer's Chrome
# These dependencies are required to run Puppeteer/Chrome in a headless environment
# The contrib.list changes for ttf-mscorefonts-installer
RUN apt-get install -y wget chromium
# Set the Chrome repo.
# Copies both package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm ci --ignore-scripts --include=dev;
# Copy the rest of the application's code into the container
COPY . .
RUN npm run postinstall
# Set up robots
RUN mv ${ROBOTS_FILE} ./static/robots.txt
# Fetch GQL schema from API at `CODEGEN_GQL_URL` and save it to schema.graphql for type generation.
RUN npm run gql:generate-schema
# This relies on schema.graphql file being present in the root dir.
RUN npm run gql:build-types
# While building the app, we set dummy values for GQL_URL so that the build passes. When running the image these need to be set in env
RUN npm run build:app
EXPOSE 8080
# Run the app (this is not a build command, it runs /build/index.js)
CMD ["node", "build"]