Skip to content

Commit

Permalink
[fix] GitHub NPM authorization of Docker building
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery committed Aug 15, 2024
1 parent 40a2980 commit b94790b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ on:
jobs:
docker:
runs-on: ubuntu-latest

permissions:
packages: read
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -42,8 +43,14 @@ jobs:

- name: Inject Environment variables
run: |
cat >> .npmrc <<EOF
//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}
@kaiyuanshe:registry=https://npm.pkg.github.com
always-auth=true
EOF
cat > .env.local <<EOF
${{ secrets.ENV_FILE }}
VERCEL_URL=hackathon.kaiyuanshe.cn
EOF
- name: Build and Push image
uses: docker/build-push-action@v3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
Expand Down

1 comment on commit b94790b

@github-actions
Copy link

@github-actions github-actions bot commented on b94790b Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for open-hackathon ready!

✅ Preview
https://open-hackathon-d7u5xh3ua-techquerys-projects.vercel.app

Built with commit b94790b.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.