Skip to content

Commit

Permalink
Stop setting container mongo port to input (#6)
Browse files Browse the repository at this point in the history
It is always 27017. Only set the host machine port to the input.
  • Loading branch information
DigiPie authored Feb 13, 2023
1 parent 624aa3a commit fc168fd
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 91 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ jobs:
runs-on: ubuntu-latest
name: Test mongo-action
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create mongo Docker container
uses: ./
with:
image_version: latest
port: 27017
- name: Install mongosh
run: |
sudo apt-get update
Expand All @@ -14,10 +21,5 @@ jobs:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-mongosh
- name: Create mongo Docker container
uses: DigiPie/[email protected]
with:
image_version: latest
port: 27017
- name: Test mongo connection
run: "sudo mongosh localhost:27017"
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

### `image_version`

**Optional:** The `mongo` Docker image version to use. Default: `"latest"`. Refer to the official [Dockerhub image page](https://hub.docker.com/_/mongo).
**Optional:** the mongo Docker image version to use. Default to `latest`. Refer to the official [Dockerhub image page](https://hub.docker.com/_/mongo).

### `port`

**Optional:** The `mongo` port to use. Default: `27017`.
**Optional:** the port where the mongo service will be published at. Defaults to `27017`. Refer to the official [docker run page](https://docs.docker.com/engine/reference/commandline/run/#publish).

## Example usage
## Example usage with mongosh

```yaml
name: mongo-action CI
Expand All @@ -25,19 +25,19 @@ jobs:
runs-on: ubuntu-latest
name: Test mongo-action
steps:
- name: Install mongosh
- name: Create mongo Docker container
uses: DigiPie/[email protected]
with:
image_version: latest
port: 27017
- name: Install mongosh command
run: |
sudo apt-get update
sudo apt-get install -y wget gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-mongosh
- name: Create mongo Docker container
uses: DigiPie/[email protected]
with:
image_version: latest
port: 27017
- name: Test mongo connection
run: "sudo mongosh localhost:27017"
```
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# action.yml
name: "mongo-action"
author: "Evan Tay"
description: "A Github Action to create a Docker container from the official mongo image."
description: "A Github Action that creates a Docker container using the official mongo image."
branding:
icon: "database"
color: "green"
Expand All @@ -11,7 +11,7 @@ inputs:
required: false
default: "latest"
port:
description: "The MongoDB port to use"
description: "The port where the mongo service will be published at"
required: false
default: 27017
runs:
Expand Down
Loading

0 comments on commit fc168fd

Please sign in to comment.