Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Add docker compose and running instructions (#22)
Browse files Browse the repository at this point in the history
* update to ssi sdk

* update readme

* config, did router test

* health and readiness api tests

* did http test

* pretty picture; readme update

* add docker-compose
  • Loading branch information
Gabe authored Apr 5, 2022
1 parent e291f40 commit c6713e1
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,25 @@ revoking, exchanging, validating, verifying credentials in varying degrees of co

## Deployment

The service will be packaged as a [Docker container](https://www.docker.com/), runnable in a wide variety of
environments. It may be expanded to support multiple protocols and transports besides HTTP/REST.
The service is packaged as a [Docker container](https://www.docker.com/), runnable in a wide variety of
environments. [Docker Compose](https://docs.docker.com/compose/) is used for simplification and orchestration. To run
the service, you can use the following command, which will start the service on port `8080`:

```shell
mage run
```

Or, you can run docker-compose yourself:

```shell
cd build && docker-compose up
```

You should then be able to send requests as follows:
```shell
~ curl localhost:8080/health
{"status":"OK"}
```

## What's Supported?

Expand Down
20 changes: 20 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.17-alpine

# Create directory for our app inside the container
WORKDIR /app

# Prepare dependencies
COPY go.mod ./
COPY go.sum ./
RUN go mod download

# Copy code /to the container image.
COPY . ./

# Build the binary and call it "docker-ssi-service"
RUN ls -alt
RUN go build -tags jwx_es256k -o /docker-ssi-service ./cmd

EXPOSE 3000

CMD [ "/docker-ssi-service" ]
8 changes: 8 additions & 0 deletions build/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.98"
services:
web:
build:
context: ../
dockerfile: build/Dockerfile
ports:
- "8080:3000"
5 changes: 5 additions & 0 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func Clean() {
os.RemoveAll("bin")
}

// Run the service via docker-compose
func Run() error {
return sh.Run("docker-compose", "--project-directory", "build", "up")
}

// Test runs unit tests without coverage.
// The mage `-v` option will trigger a verbose output of the test
func Test() error {
Expand Down

0 comments on commit c6713e1

Please sign in to comment.