-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add alpine based Dockerfile #845
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For the record: you would run this from your gnatsd directory. Whatever the state or your current branch is is what will be used to build the image. |
Dockerfile.alpine
Outdated
|
||
RUN apk add --update ca-certificates | ||
|
||
COPY --from=builder /gnatsd /gnatsd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should create a dir, nats I think, have bin and conf dirs. sym link /nats/bin/gnatsd to /bin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, I have applied the changes and this is how it looks now:
$ docker run --entrypoint /bin/sh -it wallyqs/nats-server:edge
...
/ # tree /nats/
/nats/
├── bin
│ └── gnatsd
└── conf
└── gnatsd.conf
2 directories, 2 files
/ # ls -la /bin/ | grep gnatsd -A1 -B1
lrwxrwxrwx 1 root root 12 Sep 11 20:23 getopt -> /bin/busybox
lrwxrwxrwx 1 root root 16 Dec 21 17:31 gnatsd -> /nats/bin/gnatsd
lrwxrwxrwx 1 root root 12 Sep 11 20:23 grep -> /bin/busybox
/ # ls -la /nats/*/*
-rwxr-xr-x 1 root root 8932640 Dec 21 17:30 /nats/bin/gnatsd
-rw-r--r-- 1 root root 671 Dec 21 17:05 /nats/conf/gnatsd.conf
$ docker run wallyqs/nats-server:edge
[1] 2018/12/21 17:43:36.979863 [INF] Starting nats-server version 2.0.0-beta.12
[1] 2018/12/21 17:43:36.979973 [INF] Git commit [2bc515a]
[1] 2018/12/21 17:43:36.980124 [INF] Starting http monitor on 0.0.0.0:8222
[1] 2018/12/21 17:43:36.980349 [INF] Listening for client connections on 0.0.0.0:4222
[1] 2018/12/21 17:43:36.980404 [INF] Server id is NDEHGDUGIFECN7NUZUPOEDEDVOGAPEWHQSPEGGQNSMIZFVIO2MPZSURN
[1] 2018/12/21 17:43:36.980429 [INF] Server is ready
[1] 2018/12/21 17:43:36.981009 [INF] Listening for route connections on 0.0.0.0:6222
^C[1] 2018/12/21 17:43:37.816006 [INF] Server Exiting..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok getting closer. We should symlink the binary to /bin/nats-server IMO.
Also move gnatsd to nats-server in prep for rename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would a user easily provide their own config to run this docker image? Is it easy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good on renaming, will make the changes.
About custom config, since we are using alpine then users could do something like this too now without having to mount volumes for example:
docker run --entrypoint /bin/sh wallyqs/nats-server:edge-2 -c '
cat > /nats/conf/gnatsd.conf <<CONF
listen = 4222
authorization {
user = foo
pass = bar
}
CONF
/bin/gnatsd -c /nats/conf/gnatsd.conf
'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems correct to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using volumes then yes would also be possible to override with a local file, for example:
$ echo '
listen = 4333
' > my-nats.conf
$ docker run -v $(pwd)/my-nats.conf:/nats/conf/nats.conf -it wallyqs/nats-server:edge
[1] 2018/12/21 20:12:19.113881 [INF] Starting nats-server version 2.0.0-beta.12
[1] 2018/12/21 20:12:19.114099 [INF] Listening for client connections on 0.0.0.0:4333
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok that looks good. Should we call it nats-server.conf?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok updated so that it is now nats-server.conf
eec2417
to
b7a3b24
Compare
2e64caf
to
a7dfb61
Compare
317f41e
to
0101655
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe have server conf be nats-server.conf, but otherwise LGTM. Nice..
To build it: ``` docker build -f docker/Dockerfile.alpine -t <image:tag> . ``` Signed-off-by: Waldemar Quevedo <wally@synadia.com>
0101655
to
0c65fe7
Compare
LGTM |
Adds extra Dockerfile image that can be used to build the server from master.
Signed-off-by: Waldemar Quevedo wally@synadia.com
Resolves #NNN
git pull --rebase origin master
)Changes proposed in this pull request:
/cc @nats-io/core