Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Build Fails During Docker Build Stage in GitHub Actions Workflow #225

Closed
cubxxw opened this issue Apr 9, 2024 · 2 comments
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@cubxxw
Copy link
Contributor

cubxxw commented Apr 9, 2024

What happened?

Description:
I'm encountering a build failure during the Docker build stage of my GitHub Actions workflow. The process fails when trying to set the npm registry, install npm packages, and execute a setup script. Here is the relevant part of the Dockerfile that causes the error:

FROM node:18 AS builder 

WORKDIR /openkf-web

COPY . .

RUN npm set registry http://registry.npm.taobao.org/ \
    && npm install --registry=http://registry.npm.taobao.org \
    && chmod +x scripts/setup.sh && ./scripts/setup.sh \
    && npm run build

FROM nginx:stable-alpine

COPY --from=builder /openkf-web/dist /usr/share/nginx/html

EXPOSE 8080

CMD ["nginx", "-g", "daemon off;"]

Error Message:

WARNING: local cache import at /tmp/.buildx-cache not found due to err: could not read /tmp/.buildx-cache/index.json: open /tmp/.buildx-cache/index.json: no such file or directory
ERROR: failed to solve: process "/bin/sh -c npm set registry http://registry.npm.taobao.org/ && npm install --registry=http://registry.npm.taobao.org && chmod +x scripts/setup.sh && ./scripts/setup.sh && npm run build" did not complete successfully: exit code: 1

What did you expect to happen?

Steps to Reproduce:

  1. Trigger the GitHub Actions workflow.
  2. The build fails during the Docker build stage with the above error.

Expected Behavior:
The Docker image is built successfully without errors, setting the npm registry to http://registry.npm.taobao.org/, installing dependencies, running the setup script, and building the application.

Actual Behavior:
The build process fails during the Docker build stage with warnings about the cache and errors related to npm operations.

Attempts to Fix:

  • I tried using HTTPS for the npm registry URL, but the issue persists.
  • I ensured that scripts/setup.sh is executable and runs correctly on a local environment.

How can we reproduce it (as minimally and precisely as possible)?

Questions:

  • How can I resolve the error related to setting the npm registry and installing npm packages?
  • Is there a better way to handle the Docker cache to avoid warnings about missing cache directories?

Anything else we need to know?

Additional Context:

  • Node.js version: 18
  • GitHub Actions runner: ubuntu-latest

version

```console $ {name} version # paste output here ```

Cloud provider

OS version

```console # On Linux: $ cat /etc/os-release # paste output here $ uname -a # paste output here # On Windows: C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture # paste output here ```

Install tools

@cubxxw cubxxw added the kind/bug Categorizes issue or PR as related to a bug. label Apr 9, 2024
@kubbot
Copy link
Member

kubbot commented Jun 8, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@kubbot kubbot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 8, 2024
@kubbot
Copy link
Member

kubbot commented Jun 15, 2024

This issue was closed because it has been stalled for 7 days with no activity.

@kubbot kubbot closed this as completed Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

2 participants