1
0
mirror of https://github.com/MisskeyIO/misskey synced 2025-01-22 17:53:41 +09:00

chore(build): remove corepack & fetch gitmodules on checkout (MisskeyIO#840)

This commit is contained in:
あわわわとーにゅ 2024-12-25 01:36:30 +09:00 committed by GitHub
parent 4ecfae0d85
commit 303a52160c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 59 additions and 65 deletions

View File

@ -1 +1 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:0-18
FROM mcr.microsoft.com/devcontainers/javascript-node:22

View File

@ -4,10 +4,10 @@
"service": "app",
"workspaceFolder": "/workspace",
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "20"
"ghcr.io/devcontainers/features/node:latest": {
"version": "22"
},
"ghcr.io/devcontainers-contrib/features/corepack:1": {}
"ghcr.io/devcontainers-contrib/features/pnpm:latest": {}
},
"forwardPorts": [3000],
"postCreateCommand": "sudo chmod 755 .devcontainer/init.sh && .devcontainer/init.sh",

View File

@ -4,8 +4,6 @@ set -xe
sudo chown -R node /workspace
git submodule update --init
corepack install
corepack enable
pnpm config set store-dir /home/node/.local/share/pnpm/store
pnpm install --frozen-lockfile
cp .devcontainer/devcontainer.yml .config/default.yml

View File

@ -1,3 +1,5 @@
**/.git
.autogen
.github
.travis
@ -7,24 +9,15 @@ Dockerfile
build/
built/
db/
compose.yml
docker-compose.yml
node_modules/
packages/*/node_modules
redis/
files/
fluent-emojis/
.pnp.*
# .yarn関連
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnpm-store
.idea/
packages/*/.vscode/
packages/backend/test/compose.yml
packages/backend/test/docker-compose.yml

View File

@ -15,9 +15,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- run: corepack enable
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4.1.0

View File

@ -21,7 +21,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Check version
run: |
if [ "$(jq -r '.version' package.json)" != "$(jq -r '.version' packages/misskey-js/package.json)" ]; then

View File

@ -14,6 +14,9 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

View File

@ -16,6 +16,9 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

View File

@ -16,6 +16,9 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

View File

@ -14,6 +14,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Build an image from Dockerfile
uses: docker/build-push-action@v6
with:

View File

@ -24,7 +24,7 @@ jobs:
pnpm_install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -35,7 +35,6 @@ jobs:
with:
node-version-file: '.node-version'
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
lint:
@ -50,7 +49,7 @@ jobs:
- sw
- misskey-js
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -61,7 +60,6 @@ jobs:
with:
node-version-file: '.node-version'
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
- run: pnpm --filter ${{ matrix.workspace }} run eslint
@ -75,7 +73,7 @@ jobs:
- backend
- misskey-js
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -86,7 +84,6 @@ jobs:
with:
node-version-file: '.node-version'
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
- run: pnpm -r run build:tsc
if: ${{ matrix.workspace == 'backend' }}

View File

@ -48,7 +48,7 @@ jobs:
- 56312:6379
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -63,7 +63,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
- name: Check pnpm-lock.yaml
run: git diff --exit-code pnpm-lock.yaml
@ -110,7 +109,7 @@ jobs:
- 56312:6379
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -123,7 +122,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
- name: Check pnpm-lock.yaml
run: git diff --exit-code pnpm-lock.yaml

View File

@ -30,7 +30,7 @@ jobs:
node-version: [22.x]
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -43,7 +43,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
- name: Check pnpm-lock.yaml
run: git diff --exit-code pnpm-lock.yaml

View File

@ -27,9 +27,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- run: corepack enable
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.1.0

View File

@ -20,7 +20,7 @@ jobs:
node-version: [22.x]
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -33,7 +33,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
- name: Check pnpm-lock.yaml
run: git diff --exit-code pnpm-lock.yaml

View File

@ -21,7 +21,7 @@ jobs:
node-version: [22.x]
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -36,7 +36,6 @@ jobs:
cache: 'pnpm'
- name: Install Redocly CLI
run: npm i -g @redocly/cli
- run: corepack enable
- run: pnpm i --frozen-lockfile
- name: Check pnpm-lock.yaml
run: git diff --exit-code pnpm-lock.yaml

14
.gitignore vendored
View File

@ -9,17 +9,6 @@
node_modules
report.*.json
# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
packages/frontend/.yarn/cache
packages/backend/.yarn/cache
packages/sw/.yarn/cache
# pnpm
.pnpm-store
@ -35,8 +24,11 @@ coverage
!/.config/example.yml
!/.config/docker_example.yml
!/.config/docker_example.env
compose.yml
docker-compose.yml
!/.devcontainer/compose.yml
!/.devcontainer/docker-compose.yml
!/packages/backend/test/compose.yml
!/packages/backend/test/docker-compose.yml
# misskey

View File

@ -14,11 +14,10 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
&& apt-get install -yqq --no-install-recommends \
build-essential
RUN corepack enable
WORKDIR /misskey
COPY --link pnpm-lock.yaml ./
RUN npm install -g pnpm
RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \
pnpm fetch --ignore-scripts
@ -36,11 +35,7 @@ RUN pnpm i --frozen-lockfile --aggregate-output --offline \
COPY --link . ./
ARG NODE_ENV=production
RUN git submodule update --init
RUN pnpm build
RUN rm -rf .git/
RUN NODE_ENV=production pnpm build
# build native dependencies for target platform
@ -50,11 +45,10 @@ RUN apt-get update \
&& apt-get install -yqq --no-install-recommends \
build-essential
RUN corepack enable
WORKDIR /misskey
COPY --link pnpm-lock.yaml ./
RUN npm install -g pnpm
RUN --mount=type=cache,target=/root/.local/share/pnpm/store,sharing=locked \
pnpm fetch --ignore-scripts
@ -77,7 +71,6 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl ffmpeg libjemalloc-dev libjemalloc2 tini \
&& ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so \
&& corepack enable \
&& groupadd -g "${GID}" misskey \
&& useradd -l -u "${UID}" -g "${GID}" -m -d /misskey misskey \
&& find / -type d -path /sys -prune -o -type d -path /proc -prune -o -type f -perm /u+s -ignore_readdir_race -exec chmod u-s {} \; \
@ -85,9 +78,11 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists
USER misskey
WORKDIR /misskey
COPY --chown=misskey:misskey pnpm-lock.yaml ./
RUN npm install -g pnpm
COPY --chown=misskey:misskey --from=target-builder /misskey/node_modules ./node_modules
COPY --chown=misskey:misskey --from=target-builder /misskey/packages/backend/node_modules ./packages/backend/node_modules
COPY --chown=misskey:misskey --from=target-builder /misskey/packages/misskey-js/node_modules ./packages/misskey-js/node_modules
@ -101,13 +96,10 @@ COPY --chown=misskey:misskey --from=native-builder /misskey/packages/backend/bui
COPY --chown=misskey:misskey --from=native-builder /misskey/fluent-emojis /misskey/fluent-emojis
COPY --chown=misskey:misskey . ./
RUN corepack install \
&& corepack pack
USER misskey
ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so
ENV MALLOC_CONF=background_thread:true,metadata_thp:auto,dirty_decay_ms:30000,muzzy_decay_ms:30000
ENV NODE_ENV=production
ENV COREPACK_ENABLE_NETWORK=0
HEALTHCHECK --interval=5s --retries=20 CMD ["/bin/bash", "/misskey/healthcheck.sh"]
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["pnpm", "run", "migrateandstart:docker"]