我尝试在GitHub action中创建一个自定义的Docker容器,但是我无法访问我的存储库文件。
我有这个.github/workflows/workflow.yml
:
name: Workflow
on:
push:
branches:
- my-test-branch
jobs:
testjob:
runs-on: ubuntu-20.04
name: My test job
steps:
- name: Checkout
uses: actions/checkout@v3
- name: My Custom Action
uses: ./.github/actions/my-custom-action
.github/actions/my-custom-action/action.yml
文件包含以下内容:
name: Docker container test
description: Start container
runs:
using: docker
image: ./php.dockerfile
.github/actions/my-custom-action/php.dockerfile
中包含以下内容:
FROM php:8.1-fpm-alpine
WORKDIR /var/www/html
# here I want to use COPY or ADD to attach the directory to the Docker container
我查阅了GitHub文档,但没有找到关于此主题的内容。我浏览了几个Stackoverflow和GitHub问题,并尝试了一些技巧,但没有找到有用的信息。
如何从Docker容器中访问存储库文件?