diff --git a/README.md b/README.md index 40bbad4..3a378d3 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,18 @@ jobs: CI: true ``` +### Using a Custom Mongo Image +You can utilize an alternative MongoDB docker image using the `mongodb-image` input: + + +```yaml + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.11.0 + with: + # Here we are using an image from Amazon's ECR rather than the default image from Docker Hub + mongodb-image: 'public.ecr.aws/docker/library/mongo' + mongodb-version: ${{ matrix.mongodb-version }} +``` ### With Authentication (MongoDB `--auth` Flag) Setting the `mongodb-username` and `mongodb-password` inputs. As per the [Dockerhub documentation](https://hub.docker.com/_/mongo), this automatically creates an admin user and enables `--auth` mode. diff --git a/action-types.yml b/action-types.yml index 467fe41..b03fcf8 100644 --- a/action-types.yml +++ b/action-types.yml @@ -1,5 +1,7 @@ # See https://github.com/krzema12/github-actions-typing inputs: + mongodb-image: + type: string mongodb-version: type: string mongodb-replica-set: diff --git a/action.yml b/action.yml index 170e6a9..2b237cb 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,11 @@ branding: color: 'green' inputs: + mongodb-image: + description: 'MongoDB image to use (defaults to using "mongo" from Docker Hub but you could also use an image from another repository such as Amazons "public.ecr.aws/docker/library/mongo")' + required: false + default: 'mongo' + mongodb-version: description: 'MongoDB version to use (default "latest")' required: false @@ -45,6 +50,7 @@ runs: using: 'docker' image: 'Dockerfile' args: + - ${{ inputs.mongodb-image }} - ${{ inputs.mongodb-version }} - ${{ inputs.mongodb-replica-set }} - ${{ inputs.mongodb-port }}