Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在github操作中指定dockerfile位置?_Docker_Asp.net Core_Github Actions - Fatal编程技术网

如何在github操作中指定dockerfile位置?

如何在github操作中指定dockerfile位置?,docker,asp.net-core,github-actions,Docker,Asp.net Core,Github Actions,我正在将dockerfile添加到我的asp.net核心应用程序中,它位于一个子目录中。我正试图创建一个github操作来运行dockerfile,但该操作很难找到它。 我的文件夹结构是: api/ |--Data/ |--Service/ |--|--Dockerfile |--Tests/ |--MyProject.sln frontend/ 我的action.yml是: name: Docker Image CI on: push: branches: [ master

我正在将dockerfile添加到我的asp.net核心应用程序中,它位于一个子目录中。我正试图创建一个github操作来运行dockerfile,但该操作很难找到它。 我的文件夹结构是:

api/
|--Data/
|--Service/
|--|--Dockerfile
|--Tests/
|--MyProject.sln
frontend/
我的action.yml是:


name: Docker Image CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Build the Docker image
      run: docker build ./api/Service/ --file Dockerfile --tag my-image-name:$(date +%s)

当操作运行时,我在docker构建中遇到以下错误

Run docker build ./api/Service/ --file Dockerfile --tag my-image-name:$(date +%s)
  docker build ./api/Service/ --file Dockerfile --tag my-image-name:$(date +%s)
  shell: /bin/bash -e {0}
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/runner/work/MyProject-actions/MyProject-actions/Dockerfile: no such file or directory
##[error]Process completed with exit code 1.


任何帮助都将不胜感激

这一行有一个问题:

run: docker build ./api/Service/ --file Dockerfile --tag my-image-name:$(date +%s)
--file
标志的用法错误。正确的方法是:

run: docker build --file ./api/Service/Dockerfile --tag my-image-name:$(date +%s)