npm install doesn't work in github actions docker build

Viewed 248

I have a Dockerfile like I have a dockerfile like

FROM arm32v7/node:14-buster
ARG REACT_APP_API_URL

WORKDIR ./app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "start"]

which builds on my pc but when I try building it through github actions I get The command '/bin/sh -c npm install' returned a non-zero code: 1.

The workflow file looks like

    steps:    
      - name: Checkout the code       
        uses: actions/checkout@v1      

      - name: Login to Docker Hub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_TOKEN }}
              
      - name: Build and push
        run: docker build -t maxiimillian/test:frontend ./frontend/
        
      - name: Docker Push
        run: docker push maxiimillian/test:frontend

I've tried adding --force, running apt-get install and apt-get upgrade, and using the build-and-push github action from Docker but they all have the same result, any ideas?

1 Answers

I found an early commit that didn't fail which looks like this

    steps:    
      - name: Checkout the code       
        uses: actions/checkout@v1      

      - name: Set up Docker Buildx      
        uses: crazy-max/ghaction-docker-buildx@v1      
        with:        
          version: latest        

      - name: Login to Docker Hub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_TOKEN }}
              
      - name: Run Build   
        if: success()      
        run: |        
          docker build -t maxiimillian/test:frontend ./frontend/
      - name: Push Build  
        if: success()      
        run: |        
          docker push maxiimillian/test:frontend

so it seems like the docker-buildx action is needed for whatever reason.

Related