2018-12-18 18:38:30 +01:00
|
|
|
# Builder image
|
2019-04-18 06:33:34 +02:00
|
|
|
FROM golang:1.12.4-alpine as builder
|
2018-12-18 18:38:30 +01:00
|
|
|
|
2019-04-18 06:33:34 +02:00
|
|
|
ENV TIDB_VERSION 2.1.8
|
2018-12-18 18:38:30 +01:00
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
wget \
|
|
|
|
make \
|
|
|
|
git \
|
2019-04-18 06:33:34 +02:00
|
|
|
g++ \
|
|
|
|
gcc
|
2018-12-18 18:38:30 +01:00
|
|
|
|
|
|
|
RUN git clone https://github.com/pingcap/tidb.git /go/src/github.com/pingcap/tidb
|
|
|
|
|
|
|
|
WORKDIR /go/src/github.com/pingcap/tidb/
|
|
|
|
|
|
|
|
RUN git checkout tags/v$TIDB_VERSION && rm go.sum && GO111MODULE=on go mod tidy && make
|
|
|
|
|
|
|
|
# Executable image
|
2019-04-18 06:33:34 +02:00
|
|
|
FROM alpine:3.9
|
2018-12-18 18:38:30 +01:00
|
|
|
|
|
|
|
COPY --from=builder /go/src/github.com/pingcap/tidb/bin/tidb-server /usr/local/bin/tidb-server
|
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
mysql-client \
|
|
|
|
gnupg \
|
|
|
|
openssl \
|
|
|
|
pwgen \
|
|
|
|
bash \
|
|
|
|
tzdata
|
|
|
|
|
|
|
|
COPY /docker/tidb/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
|
|
|
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
EXPOSE 4000
|
|
|
|
|
|
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|
|
|
2019-04-18 06:33:34 +02:00
|
|
|
CMD ["/usr/local/bin/tidb-server"]
|