go-fastdfs/Dockerfile

39 lines
1.2 KiB
Docker
Raw Normal View History

2023-04-17 10:18:52 +08:00
FROM registry.cn-hangzhou.aliyuncs.com/prince/alpine-golang:1.17 as builder
MAINTAINER s_jqzhang <s_jqzhang@163.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; \
mkdir -p /root/repo ; cd /root/repo ; \
git clone https://github.com/sjqzhang/go-fastdfs ; \
cd go-fastdfs; mv vendor src ; mv src .. ; cd .. ; mv go-fastdfs src/github.com/sjqzhang/ ; export GOPATH=/root/repo ; cd src/github.com/sjqzhang/go-fastdfs ; \
export GO111MODULE="off"; \
2019-01-30 15:49:28 +08:00
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
COPY --from=builder /root/repo/src/github.com/sjqzhang/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", "server" , "${OPTS}"]