Skip to content

Commit

Permalink
Fix: using pnpm from corepack when install dependency (#762)
Browse files Browse the repository at this point in the history
* feat: use pnpm from corepack to install dependency

Since package.json already has the packageManager field specified
with pnpm and its specific version, there is no reason not to use
it during whole dev/build process.

* feat: use npmmirror in Dockerfile

* feat: install pnpm through mirror

* feat(Dockerfile): set apt-get mirror
  • Loading branch information
OrkWard authored Jan 4, 2025
1 parent 2152916 commit 4b42c49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4,002 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20'

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false
- name: Enable corepack
run: corepack enable

- name: Get pnpm store directory
shell: bash
Expand Down
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
FROM python:3.10.5-slim AS develop-py
WORKDIR /root/running_page
COPY ./requirements.txt /root/running_page/requirements.txt
# Add proxy for apt.
# ENV http_proxy http://ip_address:port
# ENV https_proxy http://ip_address:port
RUN apt-get update \
RUN sed -i 's@http://archive.ubuntu.com/ubuntu/@https://mirrors.tuna.tsinghua.edu.cn/ubuntu/@g' /etc/apt/sources.list \
&& sed -i 's@http://security.ubuntu.com/ubuntu/@https://mirrors.tuna.tsinghua.edu.cn/ubuntu/@g' /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends git \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/* \
Expand All @@ -17,10 +16,9 @@ FROM node:18 AS develop-node
WORKDIR /root/running_page
COPY ./package.json /root/running_page/package.json
COPY ./pnpm-lock.yaml /root/running_page/pnpm-lock.yaml
RUN npm config rm proxy&&npm config set registry https://registry.npmjs.org/ \
&&npm install -g corepack \
&&corepack enable \
&&pnpm install
RUN npm config set registry https://registry.npmmirror.com \
&& corepack enable \
&& COREPACK_NPM_REGISTRY=https://registry.npmmirror.com pnpm install

FROM develop-py AS data
ARG app
Expand Down
Loading

0 comments on commit 4b42c49

Please sign in to comment.