github.com/bingtel/dbmate@v1.4.1/Dockerfile (about)

     1  # build image
     2  FROM golang:1.10 as build
     3  
     4  # required to force cgo (for sqlite driver) with cross compile
     5  ENV CGO_ENABLED 1
     6  
     7  # install database clients
     8  RUN apt-get update \
     9  	&& apt-get install -y --no-install-recommends \
    10  		mysql-client \
    11  		postgresql-client \
    12  		sqlite3 \
    13  	&& rm -rf /var/lib/apt/lists/*
    14  
    15  # development dependencies
    16  RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 \
    17  	&& chmod +x /usr/local/bin/dep
    18  RUN go get gopkg.in/alecthomas/gometalinter.v2 \
    19  	&& gometalinter.v2 --install
    20  
    21  # copy source files
    22  COPY . /go/src/github.com/amacneil/dbmate
    23  WORKDIR /go/src/github.com/amacneil/dbmate
    24  
    25  # build
    26  RUN make dep install build
    27  
    28  # runtime image
    29  FROM debian:stretch-slim
    30  COPY --from=build /go/src/github.com/amacneil/dbmate/dist/dbmate-linux-amd64 \
    31  	/usr/local/bin/dbmate
    32  WORKDIR /app
    33  ENTRYPOINT ["/usr/local/bin/dbmate"]