flashmob / go-guerrilla

Mini SMTP server written in golang
MIT License
2.78k stars 366 forks source link

Dockerfile #128

Open petzsch opened 5 years ago

petzsch commented 5 years ago

I thought it would be cool to have a Dockerfile for this project.

I've rudimentarily made one. Perhaps someone can find it useful and make a more generic version of it for general use? Just leaving this here as a snippet.

FROM golang AS builder
WORKDIR /source
RUN curl https://glide.sh/get | sh
RUN apt-get update && apt-get install -y git
RUN go get github.com/flashmob/go-guerrilla
RUN cd /go/src/github.com/flashmob/go-guerrilla && glide install && make guerrillad
RUN mkdir /app && cp /go/src/github.com/flashmob/go-guerrilla/guerrillad /app/ && cp /go/src/github.com/flashmob/go-guerrilla/goguerrilla.conf.sample /app/goguerrilla.conf.json

FROM alpine

RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2

WORKDIR /app

COPY --from=builder "/app" .

RUN mkdir /config

VOLUME /config

CMD ["/app/guerrillad", "serve", "-c", "/config/goguerrilla.conf.json"]

The docker image assumes that you have a volume mounted under /config/ which you use to store your configuration file and perhaps ssl/tls certs.

flashmob commented 5 years ago

Thanks for this! Nice X-mas present 😀

Will add this to the wiki.

lord-alfred commented 5 years ago

I think, now need to install dep instead of glide, right?

cd $GOPATH/src/github.com/flashmob/go-guerrilla
go get -u github.com/golang/dep/cmd/dep
dep ensure

?