2019-01-30 15:49:28 +08:00
|
|
|
FROM registry.cn-hangzhou.aliyuncs.com/prince/alpine-golang:1.11.5 as builder
|
|
|
|
MAINTAINER prince <8923052@qq.com>
|
2019-02-21 17:30:09 +08:00
|
|
|
ARG VERSION=1.1.7
|
2019-01-30 15:49:28 +08:00
|
|
|
RUN set -xe; \
|
|
|
|
apk update; \
|
|
|
|
apk add --no-cache --virtual .build-deps \
|
|
|
|
git; \
|
2019-02-21 17:30:09 +08:00
|
|
|
cd /go/src/; \
|
2019-01-30 15:49:28 +08:00
|
|
|
git clone https://github.com/sjqzhang/go-fastdfs.git; \
|
|
|
|
cd go-fastdfs; \
|
|
|
|
go get; \
|
|
|
|
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o fileserver; \
|
|
|
|
ls -lh .;
|
|
|
|
FROM registry.cn-hangzhou.aliyuncs.com/prince/alpine-bash
|
2019-02-21 17:30:09 +08:00
|
|
|
|
2019-01-30 15:49:28 +08:00
|
|
|
COPY --from=builder /go/src/go-fastdfs/fileserver /
|
2019-02-21 17:30:09 +08:00
|
|
|
|
2019-01-30 15:49:28 +08:00
|
|
|
ENV INSTALL_DIR /usr/local/go-fastdfs
|
|
|
|
|
2019-02-18 18:23:19 +08:00
|
|
|
ENV PATH $PATH:$INSTALL_DIR/
|
|
|
|
|
|
|
|
ENV GO_FASTDFS_DIR $INSTALL_DIR/data
|
|
|
|
|
2019-02-21 17:30:09 +08:00
|
|
|
RUN set -xe; \
|
|
|
|
mkdir -p $GO_FASTDFS_DIR; \
|
2019-02-18 18:23:19 +08:00
|
|
|
mkdir -p $GO_FASTDFS_DIR/conf; \
|
|
|
|
mkdir -p $GO_FASTDFS_DIR/data; \
|
|
|
|
mkdir -p $GO_FASTDFS_DIR/files; \
|
|
|
|
mkdir -p $GO_FASTDFS_DIR/log; \
|
2019-02-21 17:30:09 +08:00
|
|
|
mkdir -p $INSTALL_DIR; \
|
2019-01-30 15:49:28 +08:00
|
|
|
mv /fileserver $INSTALL_DIR/; \
|
|
|
|
chmod +x $INSTALL_DIR/fileserver;
|
|
|
|
|
|
|
|
WORKDIR $INSTALL_DIR
|
|
|
|
|
2019-02-21 17:30:09 +08:00
|
|
|
VOLUME $GO_FASTDFS_DIR
|
|
|
|
|
|
|
|
CMD ["fileserver" , "${OPTS}"]
|