Files
TheGame/docker/backend/Dockerfile
δυς 2921a47ef0 Review: meTokens ₍wᵢₜₕ gᵣₐₙᵤₗₐᵣ 𝄴ₒₘₘᵢₜₛ₎ (#1552)
* linting 🃡

* removing MetaMask specificity 🃢

* moving `StrictMode` to Next.js 🃣

* compressing & commafying 🃤

* upgrading eslint 👘

* removing preface from guild name 🃥

* removing unnecessary ESLint `no-console` directives 🌂

* fixing a typo in a comment 🃦

* updating GraphQL codegen for paid subgraph 🦏

* replacing Discord invite link 📌

* passing through The Graph API token to Docker ♾

* setting Docker ARG to set ENV 📟

* missed a file rename in frontend Docker config 🦀

* adding ts-node to fix Docker build issue ⸙

* trying to narrow down the 500 error's source in the test instance 

* exposing The Graph API token on Cloud Run 🦃

* more logging to try & find server error 🐠

* more logging 🧱

* trying to run Node.js in development mode on Cloud Run 🎁

* reconfiguring frontend Dockerfile to also run the dev environment 🌿

* dev mode seems to function 🧨

* 768MiB wasn't enough memory 🍁

* 1GiB wasn't enough memory 🔱

* 1.5GiB was interpreted as 1GiB 🥃

* 1536MiB wasn't enough memory 👾

* 2GiB wasn't enough memory 🧲

* 3GiB wasn't enough memory 🆎

* 4GiB might have been enough, but it still doesn't load 🧻

* 5GiB requires two CPUs 📝

* giving up on dev server; unexplained HTTP 429s 🎨

* disabling Honeybadger in test instances 📮

* trying an `ErrorBoundary` to gather more info 🕷

* setting GraphQL endpoint 🇲🇰

* exposing environment variables ⛈

* trying to expose `` 📻

* the Next compiled version still references `node_modules` 🦢

* removing Alchemy API key from sources 

* trying a different Docker build action 💉

* removing logging 🍿

* switching to Docker Buildx 👠

* missed an escaped newline 🗿

* trying a newer gcloud setup action 🦝

* hopefully fixing authentication 📴

* bunch of changes to the meTokens profile section 🦜

* need credentials file 🐆

* hunting for layout load error & pushing debug statements to testing 🥁

* updating eslint 💓

* trying to debug the missing Breadchain Coop 🧀

* apparently chose the wrong changeset 🐚

* removing logging 🥀
2023-05-15 09:12:03 -06:00

67 lines
2.3 KiB
Docker

FROM node:16-slim as base
WORKDIR /usr/src/app
# Install dependencies not included in the slim image
RUN apt-get update && \
apt-get install -y --no-install-recommends g++ make python git openssl && \
apt-get install -y --no-install-recommends --reinstall ca-certificates
# Install dependencies for dev and prod
COPY package.json .
COPY lerna.json .
COPY yarn.lock .
COPY schema.graphql .
COPY tsconfig.base.json .
COPY packages/backend/*.json ./packages/backend/
COPY packages/utils/*.json ./packages/utils/
COPY packages/discord-bot/*.json ./packages/discord-bot/
RUN yarn install --pure-lockfile
# Dev environment doesn't run this stage or beyond
FROM base as build
# Copy source files
COPY packages/backend ./packages/backend/
COPY packages/utils ./packages/utils/
COPY packages/discord-bot ./packages/discord-bot/
COPY packages/@types ./packages/@types/
# Set env vars
ARG GRAPHQL_HOST=hasura
ARG GRAPHQL_DOMAIN=onrender.com
ARG GRAPHQL_URL=https://$GRAPHQL_HOST.$GRAPHQL_DOMAIN/v1/graphql
ARG THE_GRAPH_API_TOKEN=unspecified
ENV GRAPHQL_URL $GRAPHQL_URL
ENV HASURA_GRAPHQL_ADMIN_SECRET metagame_secret
ENV CERAMIC_URL https://ceramic.metagame.wtf
ENV THE_GRAPH_API_TOKEN $THE_GRAPH_API_TOKEN
# Build
RUN yarn backend:build
# Delete devDependencies
RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline
# Create completely new stage including only necessary files
FROM node:16-slim as app
WORKDIR /app
# Copy necessary files into the stage
COPY --from=build /usr/src/app/package.json ./package.json
COPY --from=build /usr/src/app/node_modules ./node_modules
COPY --from=build /usr/src/app/packages/backend/package.json ./packages/backend/package.json
COPY --from=build /usr/src/app/packages/backend/dist ./packages/backend/dist
COPY --from=build /usr/src/app/packages/backend/node_modules ./packages/backend/node_modules
COPY --from=build /usr/src/app/packages/utils/package.json ./packages/utils/package.json
COPY --from=build /usr/src/app/packages/utils/dist ./packages/utils/dist
COPY --from=build /usr/src/app/packages/utils/node_modules ./packages/utils/node_modules
COPY --from=build /usr/src/app/packages/discord-bot/package.json ./packages/discord-bot/package.json
COPY --from=build /usr/src/app/packages/discord-bot/dist ./packages/discord-bot/dist
CMD ["yarn", "backend", "start"]