Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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.
Expand Down
2 changes: 2 additions & 0 deletions action-types.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# See https://github.com/krzema12/github-actions-typing
inputs:
mongodb-image:
type: string
mongodb-version:
type: string
mongodb-replica-set:
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -45,6 +50,7 @@ runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.mongodb-image }}
- ${{ inputs.mongodb-version }}
- ${{ inputs.mongodb-replica-set }}
- ${{ inputs.mongodb-port }}
Expand Down
Loading