GitHub action fails when deploying to DigitalOcean

I'm getting an error while trying to deploy to DigitalOcean through github actions and I'm not sure why it is yelling about python. Is it due to the docker images I'm using? I've tried installing the versions of python on the droplet, even though that probably has nothing to do with it.

Here is the dockerfile in question:

FROM node:alpine3.12 as build

WORKDIR /usr/src/app
COPY package*.json ./
RUN yarn cache clean && yarn --update-checksums
COPY . ./
RUN yarn && yarn build

# Stage - Production
FROM nginx:1.17-alpine
COPY --from=build /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Here is the deploy.yml file for the actions:

name: build

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Use Node.js 13.10
        uses: actions/setup-node@v1
        with:
          node-version: '13.10'
      - name: Install yarn and run unittest
        run: |
          yarn
          yarn test
        env:
          CI: true
      - name: Publish to Github Packages Registry
        uses: elgohr/Publish-Docker-Github-Action@master
        with:
          name: fanzypantz/onepole/onepole
          registry: docker.pkg.github.com
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.GITHUB_TOKEN }}
          dockerfile: Dockerfile-prod
          tags: latest
      - name: Deploy package to digitalocean
        uses: appleboy/ssh-action@master
        env:
          GITHUB_USERNAME: ${{ secrets.USERNAME }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          port: ${{ secrets.PORT }}
          envs: GITHUB_USERNAME, GITHUB_TOKEN
          script: |
            docker stop $(docker ps -a -q)
            docker login docker.pkg.github.com -u $GITHUB_USERNAME -p $GITHUB_TOKEN
            docker pull docker.pkg.github.com/fanzypantz/onepole/onepole:latest
            docker run -dit -p 80:80 docker.pkg.github.com/fanzypantz/onepole/onepole:latest

Error from github actions

Step 1/10 : FROM node:alpine3.12 as build
alpine3.12: Pulling from library/node
188c0c94c7c5: Pulling fs layer
9e35e0178777: Pulling fs layer
90f5366a8ab8: Pulling fs layer
39095b5b3547: Pulling fs layer
39095b5b3547: Waiting
188c0c94c7c5: Verifying Checksum
188c0c94c7c5: Download complete
188c0c94c7c5: Pull complete
90f5366a8ab8: Download complete
9e35e0178777: Verifying Checksum
9e35e0178777: Download complete
39095b5b3547: Verifying Checksum
39095b5b3547: Download complete
9e35e0178777: Pull complete
90f5366a8ab8: Pull complete
39095b5b3547: Pull complete
Digest: sha256:96683bc4c05c2cb2c3bee957cdf7b967051323dafb937301d4b9fac30e529d7a
Status: Downloaded newer image for node:alpine3.12
 ---> 8f99f65ba94a
Step 2/10 : WORKDIR /usr/src/app
 ---> Running in 8fa7d7cacf45
Removing intermediate container 8fa7d7cacf45
 ---> 9d3dddf518f7
Step 3/10 : COPY package*.json ./
 ---> ee091cf8a93a
Step 4/10 : RUN yarn cache clean && yarn --update-checksums
 ---> Running in d03b8ed6e52a
yarn cache v1.***.5
success Cleared cache.
Done in 0.04s.
yarn install v1.***.5
info No lockfile found.
[1/4] Resolving packages...
warning @testing-library/jest-dom > css > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning @testing-library/jest-dom > css > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning @testing-library/jest-dom > css > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning @testing-library/react > @types/testing-library__react > @types/[email protected]: This is a stub types definition. testing-library__dom provides its own type definitions, so you do not need this installed.
warning node-sass > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > node-gyp > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > request > [email protected]: this library is no longer supported
warning react-scripts > [email protected]: This loader has been deprecated. Please use eslint-webpack-plugin
warning react-scripts > jest-environment-jsdom-fourteen > jsdom > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning react-scripts > webpack-dev-server > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning react-scripts > webpack-dev-server > chokidar > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-scripts > babel-jest > @jest/transform > jest-haste-map > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-scripts > jest-environment-jsdom-fourteen > jsdom > [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/[email protected]: joi is leaving the @hapi organization and moving back to 'joi' (https://github.com/sideway/joi/issues/2411)
warning react-scripts > webpack > watchpack > watchpack-chokidar2 > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/topo > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > [email protected]: use String.prototype.padStart()
warning react-scripts > workbox-webpack-plugin > workbox-build > strip-comments > babel-plugin-transform-object-rest-spread > babel-runtime > [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=5".
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] Building fresh packages...
error /usr/src/app/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /usr/src/app/node_modules/node-sass
Output:
Building: /usr/local/bin/node /usr/src/app/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/local/bin/node',
gyp verb cli   '/usr/src/app/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/usr/src/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/src/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/src/app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/usr/src/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/src/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/src/app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (/usr/src/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/src/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/src/app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (/usr/src/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/src/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/src/app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/src/app/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/src/app/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/usr/src/app/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/src/app/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:183:21)
gyp ERR! System Linux 5.4.0-1031-azure
gyp ERR! command "/usr/local/bin/node" "/usr/src/app/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /usr/src/app/node_modules/node-sass
gyp ERR! node -v v15.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
The command '/bin/sh -c yarn cache clean && yarn --update-checksums' returned a non-zero code: 1

Upvotes: 3

Views: 2238

Answers (2)

The issue was docker images without everything I needed.

Here is the updated dockerfile-prod for the project that helped med launch it

FROM node:14.13.1-slim as build

WORKDIR /usr/src/app
COPY package*.json ./
RUN yarn cache clean && yarn --update-checksums
COPY . ./
RUN yarn && yarn build

# Stage - Production
FROM nginx:1.18.0-alpine
COPY --from=build /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Upvotes: 1

VonC
VonC

Reputation: 1329092

You have the same kind of error in sass/node-sass issue 2447, with as a solution:

I upgraded to the latest webpacker gem and the error went away

bundle update webpacker
rails webpacker:binstubs
yarn upgrade @rails/webpacker --latest
yarn upgrade webpack-dev-server --latest

But that was because, for that issue, the problem at the start of the Linking step involved webpacker.

In your case, you see

[3/4] Linking dependencies...
warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=5".
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".

So try first and upgrade in your Docker image:

Check if the issue persists with those dependencies updated.

Finally, considering the error "check python checking for Python executable "python2" in the PATH", make sure the all process uses Python2, not Python3.

Upvotes: 1

Related Questions