Skip to content

Commit

Permalink
update in-repo Docker setup to use Yarn 3
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Oldsberg <[email protected]>
  • Loading branch information
Rugvip committed Aug 31, 2022
1 parent 85bf60f commit b8991f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.git
.yarn/cache
.yarn/install-state.gz
docs
cypress
microsite
Expand Down
7 changes: 6 additions & 1 deletion packages/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ WORKDIR /app
# This switches many Node.js dependencies to production mode.
ENV NODE_ENV production

# Copy over Yarn 3 configuration, release, and plugins
COPY .yarn ./.yarn
COPY .yarnrc.yml ./

# Copy repo skeleton first, to avoid unnecessary docker cache invalidation.
# The skeleton contains the package.json of each package in the monorepo,
# and along with yarn.lock and the root package.json, that's enough to run yarn install.
COPY --chown=node:node yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz

RUN yarn install --frozen-lockfile --production --network-timeout 300000 && rm -rf "$(yarn cache dir)"
# Note that this install is not immutable, which is one of the reasons we don't recommend Yarn 3 yet
RUN yarn workspaces focus --all --production && rm -rf "$(yarn cache clean)"

# Then copy the rest of the backend bundle, along with any other files we might want.
COPY --chown=node:node packages/backend/dist/bundle.tar.gz app-config*.yaml ./
Expand Down

0 comments on commit b8991f6

Please sign in to comment.