# Source: https://blog.golang.org/docker

# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM golang:1.10

# Copy the local package files to the container's workspace.
ADD ./Gopkg.toml      /go/src/github.com/boramalper/magnetico/
ADD ./Makefile        /go/src/github.com/boramalper/magnetico/
ADD ./pkg             /go/src/github.com/boramalper/magnetico/pkg
ADD ./cmd/magneticow  /go/src/github.com/boramalper/magnetico/cmd/magneticow

# Build the outyet command inside the container.
# (You may fetch or manage dependencies here,
# either manually or with a tool like "godep".)
RUN     curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
WORKDIR /go/src/github.com/boramalper/magnetico/
RUN     make ensure
RUN     make test-persistence
RUN     make test-magneticow
RUN     make magneticow

# Run the outyet command by default when the container starts.
ENTRYPOINT ["/go/bin/magneticow"]
CMD []

# Document that the service listens on port 8080.
EXPOSE 8080
