Skip to content

Commit

Permalink
Chore/fix yarn cache folder (#60)
Browse files Browse the repository at this point in the history
* Use Yarn PnP resolver mode
  • Loading branch information
bdb-dd authored May 29, 2024
1 parent 51229aa commit 65eb1d3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ node_modules
.env*
**/yarn-error.log
.yarn/cache
!.yarn/cache/.gitkeep
Empty file removed .yarn/unplugged/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

nodeLinker: pnp
enableGlobalCache: false
yarnPath: .yarn/releases/yarn-4.2.2.cjs
23 changes: 15 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@ FROM node as builder
ARG VITE_SLACK_APP_SUPABASE_API_URL=default \
VITE_SLACK_APP_SUPABASE_ANON_KEY=default

ENV YARN_VERSION 4.2.2

USER root
RUN corepack enable yarn \
&& yarn policies set-version $YARN_VERSION
ENV YARN_VERSION 4.2.2
ENV YARN_CACHE_FOLDER .yarn/cache
RUN corepack enable yarn
RUN yarn policies set-version $YARN_VERSION \
&& yarn -v

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY . .
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn ./.yarn
COPY apps/ ./apps/
COPY packages/ ./packages/
COPY package.json yarn.lock ./

# important to prefix envvar with 'VITE_' so that is included in the build artifact
ENV VITE_SLACK_APP_SUPABASE_API_URL=$VITE_SLACK_APP_SUPABASE_API_URL
Expand All @@ -25,19 +29,22 @@ ENV VITE_SLACK_APP_SUPABASE_ANON_KEY=$VITE_SLACK_APP_SUPABASE_ANON_KEY
RUN yarn install
RUN yarn build


# production image - START
FROM node:slim as runner

ENV YARN_CACHE_FOLDER .yarn/cache
ENV NODE_ENV production

# switch back to non-root user
USER node

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY --from=builder /usr/src/app/ .

# switch back to non-root user
USER node

EXPOSE 3000
CMD node ./apps/slack-app/dist/src/app.js
ENV PORT 3000
CMD yarn run:slack-app

0 comments on commit 65eb1d3

Please sign in to comment.