Skip to content

Commit

Permalink
Merge pull request #605 from nats-io/add-env-to-dockerfile
Browse files Browse the repository at this point in the history
Add Dockerfile
  • Loading branch information
aricart authored Oct 5, 2023
2 parents 936c477 + 0bf7c5c commit aef226b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions bin/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM denoland/deno:1.29.1

# Set the working directory in the container to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app
ENV NATS_URL=localhost:4222
# Run the specified deno command
CMD ["run", "--allow-env", "--allow-net", "./bin/os_compatibility.ts"]
3 changes: 2 additions & 1 deletion bin/os_compatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import { connect, millis, Msg } from "../src/mod.ts";
import { sha256 } from "https://denopkg.com/chiefbiiko/[email protected]/mod.ts";

const nc = await connect({ servers: "localhost:4222" });
const servers = Deno.env.get("NATS_URL") || "nats://localhost:4222";
const nc = await connect({ servers });
const js = nc.jetstream();
console.log("connected");

Expand Down

0 comments on commit aef226b

Please sign in to comment.