I’m trying to build my app in Docker – and I’m stuck here… I suspect it’s a Yarn thing…
Mac OS 12.6
Node 16.16.0
Yarn 3.3.1
Redwood 3.8.0
=> ERROR [18/34] RUN yarn rw build api -v 7.1s
Error: @redwoodjs/internal tried to access @graphql-tools/code-file-loader, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: @graphql-tools/code-file-loader
Required by: @redwoodjs/internal@npm:3.8.0 (via /distribution/production/.yarn/cache/@redwoodjs-internal-npm-3.8.0-80bd5412af-f142f6e9a6.zip/node_modules/@redwoodjs/internal/dist/)
My Dockerfile:
FROM localhost/banner-support-base
WORKDIR /distribution/production
COPY graphql.config.js .
COPY .nvmrc .
RUN mkdir api web
COPY api/package.json api/.
COPY web/package.json web/.
COPY package.json .
COPY yarn.lock .
RUN corepack prepare yarn@3.3.1 --activate
RUN corepack enable yarn
RUN yarn install --network-timeout=10000000
RUN chown -R 701:701 .
COPY api api
COPY web web
COPY docker.toml redwood.toml
RUN yarn config set pnpEnableEsmLoader true
RUN yarn rw build api -v
RUN yarn rw build web -v
RUN rm -rf web/config web/public web/src web/types
RUN rm -f web/jest.config.js
RUN rm -f web/.dockerignore
RUN rm -f web/tsconfig.json
RUN rm -f web/package.json
RUN rm -f web/Dockerfile
RUN rm -f web/.DS_Store
RUN rm -rf .redwood
RUN chown 701:701 api web
WORKDIR /distribution
COPY restart-containers.sh .
COPY startApi.sh .
COPY version.* .
COPY env.* .
RUN chown 701:701 *.*
testing outside the docker container:
anon23:banner-support ajoslin$ nvm use
Found '/Users/ajoslin/EPC/Development/banner-support/.nvmrc' with version <v16.16.0>
Now using node v16.16.0 (npm v8.11.0)
anon23:banner-support ajoslin$ yarn rw upgrade
✔ Checking latest version
✔ Updating your project package.json(s)
✔ Updating /Users/ajoslin/Documents/Als/Development/EPC/Development/banner-support/package.json
✔ Updating /Users/ajoslin/Documents/Als/Development/EPC/Development/banner-support/api/package.json
✔ Updating /Users/ajoslin/Documents/Als/Development/EPC/Development/banner-support/web/package.json
✔ Running yarn install
✔ Refreshing the Prisma client
✔ De-duplicating dependencies
✔ One more thing...
🎉 Your project has been upgraded to RedwoodJS 3.8.0!
Please review the release notes for any manual steps:
❖ Redwood community discussion
❖ GitHub Release notes
anon23:banner-support ajoslin$ yarn rw build api
✔ Generating Prisma Client...
✔ Verifying graphql schema...
✔ Building API...
anon23:banner-support ajoslin$ yarn rw build web
✔ Cleaning Web...
✔ Cleaning Web...
✔ Building Web...
Starting prerendering...
You have not marked any routes to "prerender" in your Routes.
Skipping prerender...
You have not marked any routes with a path as `prerender` in `Routes.{js,tsx}`
anon23:banner-support ajoslin$
the Base dockerfile
FROM node:16.16.0-alpine
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache --virtual build-dependencies python3 jpeg-dev cairo-dev giflib-dev pango-dev make g++ tar \
&& ln -sf python3 /usr/bin/python \
&& python3 -m ensurepip \
&& pip3 install --no-cache --upgrade pip setuptools
COPY restartContainer /restartContainer
RUN npm_config_build_from_source=true yarn \
&& touch /tmp/healthy \
&& chmod 755 /restartContainer
EXPOSE 80