Skip to content

Fix GitHub Actions and support SSL #705

Description

@nickevansuk

host.docker.internal is not accessible via GitHub actions. There are two alternative approaches available, as below (which should be documented properly):

  1. Use a “container” for the job, which allows a “network-alias” to be configured, which can then be used to access the container (where the booking system resides) from the test suite. Full example here: https://github.com/openactive/OpenActive.Server.NET/blob/feature/docker-image/.github/workflows/docker-test-3.yml

  2. Use the static IP of 172.17.0.1, which can be used to access the host (where the booking system resides) from the test suite. This does not require a “container” to be used. Full example here: https://github.com/openactive/OpenActive.Server.NET/blob/feature/docker-image/.github/workflows/docker-test-4.yml

It should be possible to add host.docker.internal within docker-entrypoint.sh if the Docker container is running within a GitHub Action with something like the below, however there are issues with this as /etc/hosts is not available to the non-root user:

# Check if running inside a GitHub Action
if [ -n "$GITHUB_ACTIONS" ]; then
    echo "Running inside GitHub Actions. Adding host.docker.internal to /etc/hosts."
    echo "172.17.0.1 host.docker.internal" >> /etc/hosts
fi

A more robust solution would be to do something like the equivalent of docker create --add-host=host.docker.internal:host-gateway (where host-gateway replaces 172.17.0.1), within the GitHub action.yml. It's not clear if this is supported.

Additionally it should also be possible to trust host certificates, to allow reference implementation to be fully tested via Docker, as per https://serverfault.com/questions/1150886/docker-giving-container-access-to-hosts-ca-certs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions