我正在尝试使用 GitHub Actions 部署我的 Elastic Beanstalk 应用程序(用于 CD 目的)。在运行负责部署的作业之前,我正在构建并推送应用程序在 DockerHub 上运行所需的 docker 映像。
我面临的问题是,在从 GitHub(GitHub Actions YAML 文件)构建和运行图像后遇到Permission Denied错误,而在本地构建和运行图像时却没有遇到错误。
我的 GitHub Actions yml 文件、Dockerfile 和 sh 文件如下所示:
# .github/workflows/deploy-to-staging.yml
name: Deploy to Staging
on:
push:
branches: [ master ]
jobs:
deploy-to-staging:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Login to DockerHub
- name: Docker Login
uses: docker/login-action@v1.8.0
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
logout: true
# build, tag and push Nginx image to DockerHub
- name: Build nginx image …Run Code Online (Sandbox Code Playgroud)