[英]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.我在尝试通过 github 操作部署到 DigitalOcean 时遇到错误,我不确定为什么它会大喊大叫 python。 Is it due to the docker images I'm using?是不是因为我使用的 docker 镜像? I've tried installing the versions of python on the droplet, even though that probably has nothing to do with it.我试过在 droplet 上安装 python 的版本,尽管这可能与它无关。
Here is the dockerfile in question:这是有问题的dockerfile:
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:这是操作的 deploy.yml 文件:
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来自 github 操作的错误
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 > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @testing-library/jest-dom > css > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @testing-library/jest-dom > css > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @testing-library/react > @types/testing-library__react > @types/testing-library__dom@7.5.0: This is a stub types definition. testing-library__dom provides its own type definitions, so you do not need this installed.
warning node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > request > har-validator@5.1.5: this library is no longer supported
warning react-scripts > eslint-loader@3.0.3: This loader has been deprecated. Please use eslint-webpack-plugin
warning react-scripts > jest-environment-jsdom-fourteen > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning react-scripts > webpack-dev-server > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning react-scripts > webpack-dev-server > chokidar > fsevents@1.2.13: 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 > fsevents@1.2.13: 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 > request-promise-native@1.0.9: 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@15.1.1: 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 > chokidar@2.1.8: 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 > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > request-promise-native@1.0.9: 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/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/hoek@8.5.1: 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/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/address@2.1.4: This version has been deprecated and is no longer supported or maintained
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
warning react-scripts > workbox-webpack-plugin > workbox-build > strip-comments > babel-plugin-transform-object-rest-spread > babel-runtime > core-js@2.6.11: 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 fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @testing-library/user-event@7.2.1" has unmet peer dependency "@testing-library/dom@>=5".
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" 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 node-gyp@3.8.0
gyp info using node@15.0.0 | 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
You have the same kind of error in sass/node-sass
issue 2447 , with as a solution:您在sass/node-sass
问题 2447 中遇到了同样的错误,作为解决方案:
I upgraded to the latest webpacker gem and the error went away我升级到最新的 webpacker gem并且错误消失了
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
.但那是因为,对于那个问题,链接步骤开始时的问题涉及webpacker
。
In your case, you see在你的情况下,你看到
[3/4] Linking dependencies...
warning " > @testing-library/user-event@7.2.1" has unmet peer dependency "@testing-library/dom@>=5".
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" 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:所以首先尝试升级你的 Docker 镜像:
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.最后,考虑到错误“ check python checking for Python executable "python2" in the PATH
”,请确保所有进程使用 Python2,而不是 Python3。
The issue was docker images without everything I needed.问题是 docker 图像没有我需要的一切。
Here is the updated dockerfile-prod for the project that helped med launch it这是帮助 med 启动它的项目的更新 dockerfile-prod
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;"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.