Skip to content

Commit

Permalink
Adds Dockerfile (#317)
Browse files Browse the repository at this point in the history
* Adds Dockerfile to repo with README updates

Signed-off-by: Jordan Rash <[email protected]>
  • Loading branch information
jordan-rash committed Jul 10, 2024
1 parent 7116413 commit cd9a196
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang AS nexbuilder
WORKDIR /nex
COPY go.mod ./
RUN go mod download
COPY . .
RUN go build -o nexcli ./nex

FROM golang AS agentbuilder
WORKDIR /agent
COPY go.mod ./
RUN go mod download
COPY . .
RUN go build -o nexagent ./agent/cmd/nex-agent

FROM debian:12-slim
RUN apt-get update \
&& apt-get install -y ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /
COPY --from=nexbuilder /nex/nexcli /usr/local/bin/nex
COPY --from=agentbuilder /agent/nexagent /usr/local/bin/nex-agent
ENTRYPOINT ["nex"]
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,23 @@ In order to use your NATS context with Nex, you will need to set the `XDG_CONFIG
XDG_CONFIG_HOME=/home/jordan/.config sudo -E nex node up --loglevel debug --context default
```

## Running a nex node in Docker
We provide a Dockerfile that can be used for local development. If you choose to run a nex node in docker, it MUST run in no-sandbox mode.
```bash
docker build -t nex .

docker network create nex

#start a nats server
docker run --net nex --rm -d --name nats-server nats --js

# ‼️ make sure you edit ./examples/nodeconfigs/simple.json to reflect the setting `no_sandbox: true` ‼️
# start a nex node
docker run --net nex --rm --name nex -v ./examples/nodeconfigs:/conf nex node up --config /conf/simple.json -s nats://nats-server:4222

# interact with your node
docker run --net nex --rm nex node ls -s nats://nats-server:4222
```

## Contributing
For information on how to contribute to Nex, please read our [contributing](./CONTRIBUTING.md) guide.

0 comments on commit cd9a196

Please sign in to comment.