如何在GitHub操作中指定dockerfile位置? [英] How do I specify the dockerfile location in my github action?
本文介绍了如何在GitHub操作中指定dockerfile位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在向ASP.NET核心应用程序添加一个dockerfile,它位于一个子目录中。我正在尝试创建一个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)
当该操作运行时,我在停靠程序生成上收到以下错误。
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)
这篇关于如何在GitHub操作中指定dockerfile位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文