I've got a GitHub action (running on a self-hosted Gitea server) that runs a few docker compose commands to set up a test environment and run tests. The compose files work on my local machine and with nektos act.
The runner is set up following Gitea's guide for act runner with docker compose, which mounts the docker socket to the runner.
An example workflow:
jobs:
test_job:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
run: docker compose --profile setup up --wait
- name: Test
run: docker compose run --rm test
- name: Cleanup
if: always()
run: docker compose --profile setup down
I've narrowed the problem down to the volumes not being mounted how I'd expect. My compose file has a database service with a volume:
services:
db:
image: postgres:17
volumes:
- ./test/db/schema.sql:/docker-entrypoint-initdb.d/11schema.sql
If I attach to the database service in the action, it prints an error:
test-db | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/11schema.sql
test-db | psql:/docker-entrypoint-initdb.d/11schema.sql: error: could not read from input file: Is a directory
test-db exited with code 1
Usually "Is a directory" is a result of the mount path being empty and docker creating folders in their place, how can I make sure the volume is mounted so the compose files work both locally and in the action?