Docker support for generating single executable image

This commit is contained in:
Derek Collison
2014-07-23 17:28:52 -07:00
parent 3e86a2cbeb
commit c0941c99a8
5 changed files with 33 additions and 3 deletions

View File

@@ -1,14 +1,15 @@
# General
- [ ] Syslog support
- [ ] SSL/TLS
- [ ] nats-top equivalent
- [ ] SSL/TLS support
- [ ] nats-top equivalent, utils
- [ ] Pedantic state
- [X] Daemon mode? Won't fix
- [ ] Connz report routes
- [ ] Info updates contain other implicit route servers
- [X] Docker
- [ ] brew, apt-get, rpm, chocately (windows)
- [ ] Dynamic socket buffer sizes
- [ ] Switch to 1.3 and use maps vs hashmaps
- [ ] Buffer pools?

8
docker/Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM google/golang:1.3
MAINTAINER Derek Collison <derek@apcera.com>
RUN CGO_ENABLED=0 go get -a -ldflags '-s' github.com/apcera/gnatsd
COPY Dockerfile.final /gopath/bin/Dockerfile
CMD docker build -t apcera/gnatsd /gopath/bin

10
docker/Dockerfile.final Normal file
View File

@@ -0,0 +1,10 @@
FROM scratch
MAINTAINER Derek Collison <derek@apcera.com>
ADD gnatsd /gnatsd
CMD []
ENTRYPOINT ["/gnatsd", "-p", "4222", "-m", "8333"]
EXPOSE 4222 8333

6
docker/README.md Normal file
View File

@@ -0,0 +1,6 @@
# [Dockerized] (http://www.docker.com) [gnatsd](https://registry.hub.docker.com/u/apcera/gnatsd/)
A docker image for gnatsd. This is created as a single static executable, so there are multiple passes through Docker to first build the static executable and then to package it under an empty (scratch) base image.

5
docker/build.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
docker build -t apcera/gnatsd_build .
docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) -ti --name gnatsd_build apcera/gnatsd_build
docker rm gnatsd_build
docker rmi apcera/gnatsd_build