Skip to content

Commit a6b09cc

Browse files
Merge pull request #9 from byoungdale/byoungdale/update/add-dockerfile
adding docker file and info in readme for using them
2 parents de0a0b6 + de090fd commit a6b09cc

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Use the official Golang image as the base image
2+
FROM golang:1.14
3+
4+
# Set the working directory
5+
WORKDIR /go/src/app
6+
7+
COPY go.mod go.sum ./
8+
9+
# Download dependencies using Go modules
10+
RUN go get -d ./...
11+
12+
COPY . .
13+
14+
# Build the Call API tools and place them in the /go/bin directory
15+
RUN GOBIN=/usr/bin make install
16+
17+
# Expose the WebSocket port
18+
EXPOSE 5059
19+
20+
# Default is 'call-api' when the container starts
21+
# to run the others, simply override the CMD
22+
# docker run call-api-client
23+
# docker run call-cmd
24+
CMD ["call-api"]

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,30 @@ go run cmd/call-cmd/main.go CallStart caller=sip:alice@localhost callee=sip:bob@
154154
## Documentation
155155

156156
The [docs](docs/) folder contains the documentation for this project.
157+
158+
## Build and run docker containers
159+
160+
You can build and run the three tools under a docker container.
161+
162+
```sh
163+
docker build -t opensips-call-api:latest .
164+
```
165+
166+
By default the `call-api` will be run:
167+
168+
```sh
169+
> docker run opensips-call-api:latest
170+
time="2023-10-10T21:42:48Z" level=info msg="Listening for JSON-RPC over WebSocket on localhost:5059/call-api ..."
171+
```
172+
173+
But, you can specify the `call-cmd` and `call-api-client` tools:
174+
175+
```sh
176+
docker run opensips-call-api:latest call-api-client \
177+
-method CallStart \
178+
-params '{"caller": "sip:alice@localhost", "callee": "sip:bob@localhost"}'
179+
```
180+
181+
```bash
182+
docker run opensips-call-api:latest call-cmd CallStart caller=sip:alice@localhost callee=sip:bob@localhost
183+
```

0 commit comments

Comments
 (0)