|
@@ -4,8 +4,8 @@ LABEL maintainer="nicola.murino@gmail.com"
|
|
RUN go get -d github.com/drakkan/sftpgo
|
|
RUN go get -d github.com/drakkan/sftpgo
|
|
WORKDIR /go/src/github.com/drakkan/sftpgo
|
|
WORKDIR /go/src/github.com/drakkan/sftpgo
|
|
# uncomment the next line to get the latest stable version instead of the latest git
|
|
# uncomment the next line to get the latest stable version instead of the latest git
|
|
-#RUN git checkout `git rev-list --tags --max-count=1`
|
|
|
|
-RUN go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/utils.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/utils.date=`date -u +%FT%TZ`" -o sftpgo
|
|
|
|
|
|
+#RUN git checkout `git rev-list --tags --max-count=1`
|
|
|
|
+RUN go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/utils.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/utils.date=`date -u +%FT%TZ`" -o sftpgo
|
|
|
|
|
|
# now define the run environment
|
|
# now define the run environment
|
|
FROM debian:latest
|
|
FROM debian:latest
|
|
@@ -22,24 +22,24 @@ ARG GID=515
|
|
ENV HOME_DIR=${BASE_DIR}/${USERNAME}
|
|
ENV HOME_DIR=${BASE_DIR}/${USERNAME}
|
|
# DATA_DIR, this is a volume that you can use hold user's home dirs
|
|
# DATA_DIR, this is a volume that you can use hold user's home dirs
|
|
ENV DATA_DIR=${BASE_DIR}/${DATA_REL_DIR}
|
|
ENV DATA_DIR=${BASE_DIR}/${DATA_REL_DIR}
|
|
-# CONFIG_DIR, this is a volume to persist the daemon private keys, configuration file ecc..
|
|
|
|
|
|
+# CONFIG_DIR, this is a volume to persist the daemon private keys, configuration file ecc..
|
|
ENV CONFIG_DIR=${BASE_DIR}/${CONFIG_REL_DIR}
|
|
ENV CONFIG_DIR=${BASE_DIR}/${CONFIG_REL_DIR}
|
|
|
|
|
|
RUN mkdir -p ${DATA_DIR} ${CONFIG_DIR}
|
|
RUN mkdir -p ${DATA_DIR} ${CONFIG_DIR}
|
|
RUN groupadd --system -g ${GID} ${GROUPNAME}
|
|
RUN groupadd --system -g ${GID} ${GROUPNAME}
|
|
RUN useradd --system --create-home --no-log-init --home-dir ${HOME_DIR} --comment "SFTPGo user" --shell /bin/false --gid ${GID} --uid ${UID} ${USERNAME}
|
|
RUN useradd --system --create-home --no-log-init --home-dir ${HOME_DIR} --comment "SFTPGo user" --shell /bin/false --gid ${GID} --uid ${UID} ${USERNAME}
|
|
|
|
|
|
-WORKDIR ${HOME_DIR}
|
|
|
|
|
|
+WORKDIR ${HOME_DIR}
|
|
RUN mkdir -p bin .config/sftpgo
|
|
RUN mkdir -p bin .config/sftpgo
|
|
ENV PATH ${HOME_DIR}/bin:$PATH
|
|
ENV PATH ${HOME_DIR}/bin:$PATH
|
|
-COPY --from=buildenv /go/src/github.com/drakkan/sftpgo/sftpgo bin/sftpgo
|
|
|
|
|
|
+COPY --from=buildenv /go/src/github.com/drakkan/sftpgo/sftpgo bin/sftpgo
|
|
# default config file to use if no config file is found inside the CONFIG_DIR volume.
|
|
# default config file to use if no config file is found inside the CONFIG_DIR volume.
|
|
# You can override each configuration options via env vars too
|
|
# You can override each configuration options via env vars too
|
|
COPY --from=buildenv /go/src/github.com/drakkan/sftpgo/sftpgo.json .config/sftpgo/
|
|
COPY --from=buildenv /go/src/github.com/drakkan/sftpgo/sftpgo.json .config/sftpgo/
|
|
-RUN chown -R ${UID}:${GID} ${DATA_DIR}
|
|
|
|
|
|
+RUN chown -R ${UID}:${GID} ${DATA_DIR}
|
|
|
|
|
|
# run as non root user
|
|
# run as non root user
|
|
-USER ${USERNAME}
|
|
|
|
|
|
+USER ${USERNAME}
|
|
|
|
|
|
EXPOSE 2022 8080
|
|
EXPOSE 2022 8080
|
|
|
|
|