Skip to content

Commit

Permalink
Merge pull request #14916 from Budibase/ci/reenable-cache
Browse files Browse the repository at this point in the history
Reenable cache
  • Loading branch information
adrinr authored Oct 30, 2024
2 parents d20146e + d510cf8 commit b8e6f8a
Show file tree
Hide file tree
Showing 6 changed files with 292 additions and 11 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/budibase_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,27 @@ jobs:
} else {
console.log('All good, the submodule had been merged and setup correctly!')
}
check-lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: ${{ env.IS_OSS_CONTRIBUTOR == 'false' }}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
- run: yarn install
- name: Check for yarn.lock changes
run: |
if [[ $(git status --porcelain) == *"yarn.lock"* ]]; then
echo "yarn.lock file needs to be modified. Please update it locally and commit the changes."
exit 1
else
echo "yarn.lock file is unchanged."
fi
3 changes: 2 additions & 1 deletion hosting/single/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ RUN ./scripts/removeWorkspaceDependencies.sh packages/worker/package.json

RUN jq 'del(.scripts.postinstall)' package.json > temp.json && mv temp.json package.json
RUN ./scripts/removeWorkspaceDependencies.sh package.json
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production --frozen-lockfile --network-concurrency 1
ARG TARGETPLATFORM
RUN --mount=type=cache,target=/root/.yarn/${TARGETPLATFORM} YARN_CACHE_FOLDER=/root/.yarn/${TARGETPLATFORM} yarn install --production --frozen-lockfile

# copy the actual code
COPY packages/server/dist packages/server/dist
Expand Down
2 changes: 1 addition & 1 deletion packages/account-portal
3 changes: 2 additions & 1 deletion packages/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ RUN chmod +x ./scripts/removeWorkspaceDependencies.sh
RUN ./scripts/removeWorkspaceDependencies.sh package.json

# Install yarn packages with caching
RUN yarn install --production=true --network-timeout 1000000 \
ARG TARGETPLATFORM
RUN --mount=type=cache,target=/root/.yarn/${TARGETPLATFORM} YARN_CACHE_FOLDER=/root/.yarn/${TARGETPLATFORM} yarn install --production \
&& yarn cache clean \
&& apk del g++ make python3 jq \
&& rm -rf /tmp/* /root/.node-gyp /usr/local/lib/node_modules/npm/node_modules/node-gyp
Expand Down
3 changes: 2 additions & 1 deletion packages/worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ COPY packages/worker/dist/yarn.lock .

RUN ../scripts/removeWorkspaceDependencies.sh package.json

RUN yarn install --production=true --network-timeout 1000000
ARG TARGETPLATFORM
RUN --mount=type=cache,target=/root/.yarn/${TARGETPLATFORM} YARN_CACHE_FOLDER=/root/.yarn/${TARGETPLATFORM} yarn install --production
# Remove unneeded data from file system to reduce image size
RUN apk del .gyp \
&& yarn cache clean
Expand Down
Loading

0 comments on commit b8e6f8a

Please sign in to comment.