diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2018-08-07 14:38:40 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2018-08-07 14:54:48 +0100 |
commit | b7b3e5cfad53732a379b3784ec2c3b72577ab665 (patch) | |
tree | c46d7ea1c2bcd8c5791a677e3c0c901251c60736 | |
parent | 446206904ecf600375d3022419d9b73f1c3bdbfa (diff) |
Use multi-stage build with current Go version
-rw-r--r-- | Dockerfile | 17 | ||||
-rw-r--r-- | README.md | 7 |
2 files changed, 17 insertions, 7 deletions
@@ -1,9 +1,12 @@ -FROM golang:1.7-alpine +FROM golang:latest as build +LABEL maintainer="nsheridan@gmail.com" +ARG SRC_DIR=/go/src/github.com/nsheridan/cashier +WORKDIR ${SRC_DIR} +ADD . ${SRC_DIR} +RUN CGO_ENABLED=0 GOOS=linux go install -a -installsuffix static ./cmd/cashierd -ADD . /go/src/github.com/nsheridan/cashier -RUN apk add --update build-base -RUN go install github.com/nsheridan/cashier/cmd/cashierd - -VOLUME /cashier +FROM scratch +LABEL maintainer="nsheridan@gmail.com" WORKDIR /cashier -ENTRYPOINT /go/bin/cashierd +COPY --from=build /go/bin/cashierd / +ENTRYPOINT ["/cashierd"] @@ -5,6 +5,7 @@ - [Cashier](#cashier) - [How it works](#how-it-works) - [Installing](#installing) + - [Docker](#docker) - [Requirements](#requirements) - [Server](#server) - [Client](#client) @@ -67,6 +68,12 @@ The server requires a configuration file ([sample config](example-server.conf)). See [the configuration section](#configuration) for more detail. +## Docker +A [docker image is available](https://hub.docker.com/r/nsheridan/cashier). Example usage: +``` +docker run -it --rm -p 10000:10000 --name cashier -v ${PWD}:/cashier nsheridan/cashier +``` + # Requirements ## Server Go 1.10 or later, though it may work with earlier versions. |