From d65c00728a65bdc0d502fb9d3bb79796ee5619f3 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Thu, 11 Aug 2022 11:27:35 +0200 Subject: [PATCH] docker: add a variant with official plugins included Signed-off-by: Nicola Murino --- .github/workflows/docker.yml | 12 +++ Dockerfile | 7 +- docker/README.md | 7 +- docker/scripts/download-plugins.sh | 24 ++++++ docker/scripts/entrypoint-alpine.sh | 28 ------- docker/scripts/entrypoint.sh | 32 -------- docker/sftpgo/alpine/Dockerfile | 50 ------------ docker/sftpgo/alpine/README.md | 61 --------------- docker/sftpgo/alpine/docker-entrypoint.sh | 7 -- docker/sftpgo/alpine/sftpgo.service | 35 --------- docker/sftpgo/debian/Dockerfile | 93 ----------------------- docker/sftpgo/debian/README.md | 59 -------------- 12 files changed, 48 insertions(+), 367 deletions(-) create mode 100755 docker/scripts/download-plugins.sh delete mode 100755 docker/scripts/entrypoint-alpine.sh delete mode 100755 docker/scripts/entrypoint.sh delete mode 100644 docker/sftpgo/alpine/Dockerfile delete mode 100644 docker/sftpgo/alpine/README.md delete mode 100755 docker/sftpgo/alpine/docker-entrypoint.sh delete mode 100644 docker/sftpgo/alpine/sftpgo.service delete mode 100644 docker/sftpgo/debian/Dockerfile delete mode 100644 docker/sftpgo/debian/README.md diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4e2e4f66..db888ceb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,6 +28,9 @@ jobs: - os: ubuntu-latest docker_pkg: distroless optional_deps: false + - os: ubuntu-latest + docker_pkg: debian-plugins + optional_deps: true steps: - name: Checkout uses: actions/checkout@v3 @@ -64,6 +67,9 @@ jobs: VERSION="${VERSION}-distroless" VERSION_SLIM="${VERSION}-slim" DOCKERFILE=Dockerfile.distroless + elif [[ $DOCKER_PKG == debian-plugins ]]; then + VERSION="${VERSION}-plugins" + VERSION_SLIM="${VERSION}-slim" fi DOCKER_IMAGES=("drakkan/sftpgo" "ghcr.io/drakkan/sftpgo") TAGS="${DOCKER_IMAGES[0]}:${VERSION}" @@ -109,6 +115,11 @@ jobs: echo ::set-output name=tags::${TAGS_SLIM} echo ::set-output name=full::false fi + if [[ $DOCKER_PKG == debian-plugins ]]; then + echo ::set-output name=plugins::true + else + echo ::set-output name=plugins::false + fi echo ::set-output name=dockerfile::${DOCKERFILE} echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') echo ::set-output name=sha::${GITHUB_SHA::8} @@ -150,6 +161,7 @@ jobs: build-args: | COMMIT_SHA=${{ steps.info.outputs.sha }} INSTALL_OPTIONAL_PACKAGES=${{ steps.info.outputs.full }} + DOWNLOAD_PLUGINS=${{ steps.info.outputs.plugins }} labels: | org.opencontainers.image.title=SFTPGo org.opencontainers.image.description=Fully featured and highly configurable SFTP server with optional HTTP, FTP/S and WebDAV support diff --git a/Dockerfile b/Dockerfile index 028850de..9c740b26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,11 @@ RUN set -xe && \ export COMMIT_SHA=${COMMIT_SHA:-$(git describe --always --dirty)} && \ go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=${COMMIT_SHA} -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -v -o sftpgo +# Set to "true" to download the "official" plugins in /usr/local/bin +ARG DOWNLOAD_PLUGINS=false + +RUN if [ "${DOWNLOAD_PLUGINS}" = "true" ]; then apt-get update && apt-get install --no-install-recommends -y curl && ./docker/scripts/download-plugins.sh; fi + FROM debian:bullseye-slim # Set to "true" to install jq and the optional git and rsync dependencies @@ -43,7 +48,7 @@ COPY --from=builder /workspace/sftpgo.json /etc/sftpgo/sftpgo.json COPY --from=builder /workspace/templates /usr/share/sftpgo/templates COPY --from=builder /workspace/static /usr/share/sftpgo/static COPY --from=builder /workspace/openapi /usr/share/sftpgo/openapi -COPY --from=builder /workspace/sftpgo /usr/local/bin/ +COPY --from=builder /workspace/sftpgo /usr/local/bin/sftpgo-plugin-* /usr/local/bin/ # Log to the stdout so the logs will be available using docker logs ENV SFTPGO_LOG_FILE_PATH="" diff --git a/docker/README.md b/docker/README.md index 5bfa3584..d9d9231a 100644 --- a/docker/README.md +++ b/docker/README.md @@ -10,6 +10,7 @@ SFTPGo provides an official Docker image, it is available on both [Docker Hub](h - [v2.3.3-alpine-slim, v2.3-alpine-slim, v2-alpine-slim, alpine-slim](https://github.com/drakkan/sftpgo/blob/v2.3.3/Dockerfile.alpine) - [v2.3.3-distroless-slim, v2.3-distroless-slim, v2-distroless-slim, distroless-slim](https://github.com/drakkan/sftpgo/blob/v2.3.3/Dockerfile.distroless) - [edge](../Dockerfile) +- [edge-plugins](../Dockerfile) - [edge-alpine](../Dockerfile.alpine) - [edge-slim](../Dockerfile) - [edge-alpine-slim](../Dockerfile.alpine) @@ -197,7 +198,11 @@ We only provide the slim variant and so the optional `git` dependency is not ava ### `sftpgo:-slim` -These tags provide a slimmer image that does not include the optional `git` dependency. +These tags provide a slimmer image that does not include the optional `git`, `rsync` and `jq` dependencies. + +### `sftpgo:-plugins` + +These tags provide the standard image with the addition of all "official" plugins installed in `/usr/local/bin`. ## Helm Chart diff --git a/docker/scripts/download-plugins.sh b/docker/scripts/download-plugins.sh new file mode 100755 index 00000000..6dcf966e --- /dev/null +++ b/docker/scripts/download-plugins.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +ARCH=`uname -m` + +case ${ARCH} in + "x86_64") + SUFFIX=amd64 + ;; + "aarch64") + SUFFIX=arm64 + ;; + *) + SUFFIX=ppc64le + ;; +esac + +echo "download plugins for arch ${SUFFIX}" + +for PLUGIN in geoipfilter kms pubsub eventstore eventsearch metadata +do + echo "download plugin from https://github.com/sftpgo/sftpgo-plugin-${PLUGIN}/releases/latest/download/sftpgo-plugin-${PLUGIN}-linux-${SUFFIX}" + curl -L "https://github.com/sftpgo/sftpgo-plugin-${PLUGIN}/releases/latest/download/sftpgo-plugin-${PLUGIN}-linux-${SUFFIX}" --output "/usr/local/bin/sftpgo-plugin-${PLUGIN}" + chmod 755 "/usr/local/bin/sftpgo-plugin-${PLUGIN}" +done diff --git a/docker/scripts/entrypoint-alpine.sh b/docker/scripts/entrypoint-alpine.sh deleted file mode 100755 index ff22fc0f..00000000 --- a/docker/scripts/entrypoint-alpine.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -SFTPGO_PUID=${SFTPGO_PUID:-1000} -SFTPGO_PGID=${SFTPGO_PGID:-1000} - -if [ "$1" = 'sftpgo' ]; then - if [ "$(id -u)" = '0' ]; then - for DIR in "/etc/sftpgo" "/var/lib/sftpgo" "/srv/sftpgo" - do - DIR_UID=$(stat -c %u ${DIR}) - DIR_GID=$(stat -c %g ${DIR}) - if [ ${DIR_UID} != ${SFTPGO_PUID} ] || [ ${DIR_GID} != ${SFTPGO_PGID} ]; then - echo '{"level":"info","time":"'`date +%Y-%m-%dT%H:%M:%S.000`'","sender":"entrypoint","message":"change owner for \"'${DIR}'\" UID: '${SFTPGO_PUID}' GID: '${SFTPGO_PGID}'"}' - if [ ${DIR} = "/etc/sftpgo" ]; then - chown -R ${SFTPGO_PUID}:${SFTPGO_PGID} ${DIR} - else - chown ${SFTPGO_PUID}:${SFTPGO_PGID} ${DIR} - fi - fi - done - echo '{"level":"info","time":"'`date +%Y-%m-%dT%H:%M:%S.000`'","sender":"entrypoint","message":"run as UID: '${SFTPGO_PUID}' GID: '${SFTPGO_PGID}'"}' - exec su-exec ${SFTPGO_PUID}:${SFTPGO_PGID} "$@" - fi - - exec "$@" -fi - -exec "$@" \ No newline at end of file diff --git a/docker/scripts/entrypoint.sh b/docker/scripts/entrypoint.sh deleted file mode 100755 index 04d29c7a..00000000 --- a/docker/scripts/entrypoint.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -SFTPGO_PUID=${SFTPGO_PUID:-1000} -SFTPGO_PGID=${SFTPGO_PGID:-1000} - -if [ "$1" = 'sftpgo' ]; then - if [ "$(id -u)" = '0' ]; then - getent passwd ${SFTPGO_PUID} > /dev/null - HAS_PUID=$? - getent group ${SFTPGO_PGID} > /dev/null - HAS_PGID=$? - if [ ${HAS_PUID} -ne 0 ] || [ ${HAS_PGID} -ne 0 ]; then - echo '{"level":"info","time":"'`date +%Y-%m-%dT%H:%M:%S.%3N`'","sender":"entrypoint","message":"prepare to run as UID: '${SFTPGO_PUID}' GID: '${SFTPGO_PGID}'"}' - if [ ${HAS_PGID} -ne 0 ]; then - echo '{"level":"info","time":"'`date +%Y-%m-%dT%H:%M:%S.%3N`'","sender":"entrypoint","message":"set GID to: '${SFTPGO_PGID}'"}' - groupmod -g ${SFTPGO_PGID} sftpgo - fi - if [ ${HAS_PUID} -ne 0 ]; then - echo '{"level":"info","time":"'`date +%Y-%m-%dT%H:%M:%S.%3N`'","sender":"entrypoint","message":"set UID to: '${SFTPGO_PUID}'"}' - usermod -u ${SFTPGO_PUID} sftpgo - fi - chown -R ${SFTPGO_PUID}:${SFTPGO_PGID} /etc/sftpgo - chown ${SFTPGO_PUID}:${SFTPGO_PGID} /var/lib/sftpgo /srv/sftpgo - fi - echo '{"level":"info","time":"'`date +%Y-%m-%dT%H:%M:%S.%3N`'","sender":"entrypoint","message":"run as UID: '${SFTPGO_PUID}' GID: '${SFTPGO_PGID}'"}' - exec gosu ${SFTPGO_PUID}:${SFTPGO_PGID} "$@" - fi - - exec "$@" -fi - -exec "$@" \ No newline at end of file diff --git a/docker/sftpgo/alpine/Dockerfile b/docker/sftpgo/alpine/Dockerfile deleted file mode 100644 index 82ccbeb6..00000000 --- a/docker/sftpgo/alpine/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -FROM golang:alpine as builder - -RUN apk add --no-cache git gcc g++ ca-certificates \ - && go get -v -d github.com/drakkan/sftpgo -WORKDIR /go/src/github.com/drakkan/sftpgo -ARG TAG -ARG FEATURES -# Use --build-arg TAG=LATEST for latest tag. Use e.g. --build-arg TAG=v1.0.0 for a specific tag/commit. Otherwise HEAD (master) is built. -RUN git checkout $(if [ "${TAG}" = LATEST ]; then echo `git rev-list --tags --max-count=1`; elif [ -n "${TAG}" ]; then echo "${TAG}"; else echo HEAD; fi) -RUN go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -v -o /go/bin/sftpgo - -FROM alpine:latest - -RUN apk add --no-cache ca-certificates su-exec \ - && mkdir -p /data /etc/sftpgo /srv/sftpgo/config /srv/sftpgo/web /srv/sftpgo/backups - -# git and rsync are optional, uncomment the next line to add support for them if needed. -#RUN apk add --no-cache git rsync - -COPY --from=builder /go/bin/sftpgo /bin/ -COPY --from=builder /go/src/github.com/drakkan/sftpgo/sftpgo.json /etc/sftpgo/sftpgo.json -COPY --from=builder /go/src/github.com/drakkan/sftpgo/templates /srv/sftpgo/web/templates -COPY --from=builder /go/src/github.com/drakkan/sftpgo/static /srv/sftpgo/web/static -COPY docker-entrypoint.sh /bin/entrypoint.sh -RUN chmod +x /bin/entrypoint.sh - -VOLUME [ "/data", "/srv/sftpgo/config", "/srv/sftpgo/backups" ] -EXPOSE 2022 8080 - -# uncomment the following settings to enable FTP support -#ENV SFTPGO_FTPD__BIND_PORT=2121 -#ENV SFTPGO_FTPD__FORCE_PASSIVE_IP= -#EXPOSE 2121 - -# we need to expose the passive ports range too -#EXPOSE 50000-50100 - -# it is a good idea to provide certificates to enable FTPS too -#ENV SFTPGO_FTPD__CERTIFICATE_FILE=/srv/sftpgo/config/mycert.crt -#ENV SFTPGO_FTPD__CERTIFICATE_KEY_FILE=/srv/sftpgo/config/mycert.key - -# uncomment the following setting to enable WebDAV support -#ENV SFTPGO_WEBDAVD__BIND_PORT=8090 - -# it is a good idea to provide certificates to enable WebDAV over HTTPS -#ENV SFTPGO_WEBDAVD__CERTIFICATE_FILE=${CONFIG_DIR}/mycert.crt -#ENV SFTPGO_WEBDAVD__CERTIFICATE_KEY_FILE=${CONFIG_DIR}/mycert.key - -ENTRYPOINT ["/bin/entrypoint.sh"] -CMD ["serve"] diff --git a/docker/sftpgo/alpine/README.md b/docker/sftpgo/alpine/README.md deleted file mode 100644 index d9ba2090..00000000 --- a/docker/sftpgo/alpine/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# SFTPGo with Docker and Alpine - -:warning: The recommended way to run SFTPGo on Docker is to use the official [images](https://hub.docker.com/r/drakkan/sftpgo). The documentation here is now obsolete. - -This DockerFile is made to build image to host multiple instances of SFTPGo started with different users. - -## Example - -> 1003 is a custom uid:gid for this instance of SFTPGo - -```bash -# Prereq on docker host -sudo groupadd -g 1003 sftpgrp && \ - sudo useradd -u 1003 -g 1003 sftpuser -d /home/sftpuser/ && \ - sudo -u sftpuser mkdir /home/sftpuser/{conf,data} && \ - curl https://raw.githubusercontent.com/drakkan/sftpgo/master/sftpgo.json -o /home/sftpuser/conf/sftpgo.json - -# Edit sftpgo.json as you need - -# Get and build SFTPGo image. -# Add --build-arg TAG=LATEST to build the latest tag or e.g. TAG=v1.0.0 for a specific tag/commit. -# Add --build-arg FEATURES= to specify the features to build. -git clone https://github.com/drakkan/sftpgo.git && \ - cd sftpgo && \ - sudo docker build -t sftpgo docker/sftpgo/alpine/ - -# Initialize the configured provider. For PostgreSQL and MySQL providers you need to create the configured database and the "initprovider" command will create the required tables. -sudo docker run --name sftpgo \ - -e PUID=1003 \ - -e GUID=1003 \ - -v /home/sftpuser/conf/:/srv/sftpgo/config \ - sftpgo initprovider -c /srv/sftpgo/config - -# Start the image -sudo docker rm sftpgo && sudo docker run --name sftpgo \ - -e SFTPGO_LOG_FILE_PATH= \ - -e SFTPGO_CONFIG_DIR=/srv/sftpgo/config \ - -e SFTPGO_HTTPD__TEMPLATES_PATH=/srv/sftpgo/web/templates \ - -e SFTPGO_HTTPD__STATIC_FILES_PATH=/srv/sftpgo/web/static \ - -e SFTPGO_HTTPD__BACKUPS_PATH=/srv/sftpgo/backups \ - -p 8080:8080 \ - -p 2022:2022 \ - -e PUID=1003 \ - -e GUID=1003 \ - -v /home/sftpuser/conf/:/srv/sftpgo/config \ - -v /home/sftpuser/data:/data \ - -v /home/sftpuser/backups:/srv/sftpgo/backups \ - sftpgo -``` - -If you want to enable FTP/S you also need the publish the FTP port and the FTP passive port range, defined in your `Dockerfile`, by adding, for example, the following options to the `docker run` command `-p 2121:2121 -p 50000-50100:50000-50100`. The same goes for WebDAV, you need to publish the configured port. - -The script `entrypoint.sh` makes sure to correct the permissions of directories and start the process with the right user. - -Several images can be run with different parameters. - -## Custom systemd script - -An example of systemd script is present [here](sftpgo.service), with `Environment` parameter to set `PUID` and `GUID` - -`WorkingDirectory` parameter must be exist with one file in this directory like `sftpgo-${PUID}.env` corresponding to the variable file for SFTPGo instance. diff --git a/docker/sftpgo/alpine/docker-entrypoint.sh b/docker/sftpgo/alpine/docker-entrypoint.sh deleted file mode 100755 index 62054359..00000000 --- a/docker/sftpgo/alpine/docker-entrypoint.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -set -eu - -chown -R "${PUID}:${GUID}" /data /etc/sftpgo /srv/sftpgo/config /srv/sftpgo/backups \ - && exec su-exec "${PUID}:${GUID}" \ - /bin/sftpgo "$@" diff --git a/docker/sftpgo/alpine/sftpgo.service b/docker/sftpgo/alpine/sftpgo.service deleted file mode 100644 index 901a6ab8..00000000 --- a/docker/sftpgo/alpine/sftpgo.service +++ /dev/null @@ -1,35 +0,0 @@ -[Unit] -Description=SFTPGo server -After=docker.service - -[Service] -User=root -Group=root -WorkingDirectory=/etc/sftpgo -Environment=PUID=1003 -Environment=GUID=1003 -EnvironmentFile=-/etc/sysconfig/sftpgo.env -ExecStartPre=-docker kill sftpgo -ExecStartPre=-docker rm sftpgo -ExecStart=docker run --name sftpgo \ - --env-file sftpgo-${PUID}.env \ - -e PUID=${PUID} \ - -e GUID=${GUID} \ - -e SFTPGO_LOG_FILE_PATH= \ - -e SFTPGO_CONFIG_DIR=/srv/sftpgo/config \ - -e SFTPGO_HTTPD__TEMPLATES_PATH=/srv/sftpgo/web/templates \ - -e SFTPGO_HTTPD__STATIC_FILES_PATH=/srv/sftpgo/web/static \ - -e SFTPGO_HTTPD__BACKUPS_PATH=/srv/sftpgo/backups \ - -p 8080:8080 \ - -p 2022:2022 \ - -v /home/sftpuser/conf/:/srv/sftpgo/config \ - -v /home/sftpuser/data:/data \ - -v /home/sftpuser/backups:/srv/sftpgo/backups \ - sftpgo -ExecStop=docker stop sftpgo -SyslogIdentifier=sftpgo -Restart=always -RestartSec=10s - -[Install] -WantedBy=multi-user.target diff --git a/docker/sftpgo/debian/Dockerfile b/docker/sftpgo/debian/Dockerfile deleted file mode 100644 index 8a0db73d..00000000 --- a/docker/sftpgo/debian/Dockerfile +++ /dev/null @@ -1,93 +0,0 @@ -# we use a multi stage build to have a separate build and run env -FROM golang:latest as buildenv -LABEL maintainer="nicola.murino@gmail.com" -RUN go get -v -d github.com/drakkan/sftpgo -WORKDIR /go/src/github.com/drakkan/sftpgo -ARG TAG -ARG FEATURES -# Use --build-arg TAG=LATEST for latest tag. Use e.g. --build-arg TAG=v1.0.0 for a specific tag/commit. Otherwise HEAD (master) is built. -RUN git checkout $(if [ "${TAG}" = LATEST ]; then echo `git rev-list --tags --max-count=1`; elif [ -n "${TAG}" ]; then echo "${TAG}"; else echo HEAD; fi) -RUN go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -v -o sftpgo - -# now define the run environment -FROM debian:latest - -# ca-certificates is needed for Cloud Storage Support and for HTTPS/FTPS. -RUN apt-get update && apt-get install -y ca-certificates && apt-get clean - -# git and rsync are optional, uncomment the next line to add support for them if needed. -#RUN apt-get update && apt-get install -y git rsync && apt-get clean - -ARG BASE_DIR=/app -ARG DATA_REL_DIR=data -ARG CONFIG_REL_DIR=config -ARG BACKUP_REL_DIR=backups -ARG USERNAME=sftpgo -ARG GROUPNAME=sftpgo -ARG UID=515 -ARG GID=515 -ARG WEB_REL_PATH=web - -# HOME_DIR for sftpgo itself -ENV HOME_DIR=${BASE_DIR}/${USERNAME} -# DATA_DIR, this is a volume that you can use hold user's home dirs -ENV DATA_DIR=${BASE_DIR}/${DATA_REL_DIR} -# CONFIG_DIR, this is a volume to persist the daemon private keys, configuration file ecc.. -ENV CONFIG_DIR=${BASE_DIR}/${CONFIG_REL_DIR} -# BACKUPS_DIR, this is a volume to store backups done using "dumpdata" REST API -ENV BACKUPS_DIR=${BASE_DIR}/${BACKUP_REL_DIR} -ENV WEB_DIR=${BASE_DIR}/${WEB_REL_PATH} - -RUN mkdir -p ${DATA_DIR} ${CONFIG_DIR} ${WEB_DIR} ${BACKUPS_DIR} -RUN groupadd --system -g ${GID} ${GROUPNAME} -RUN useradd --system --create-home --no-log-init --home-dir ${HOME_DIR} --comment "SFTPGo user" --shell /usr/sbin/nologin --gid ${GID} --uid ${UID} ${USERNAME} - -WORKDIR ${HOME_DIR} -RUN mkdir -p bin .config/sftpgo -ENV PATH ${HOME_DIR}/bin:$PATH -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. -# 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/templates ${WEB_DIR}/templates -COPY --from=buildenv /go/src/github.com/drakkan/sftpgo/static ${WEB_DIR}/static -RUN chown -R ${UID}:${GID} ${DATA_DIR} ${BACKUPS_DIR} - -# run as non root user -USER ${USERNAME} - -EXPOSE 2022 8080 - -# the defined volumes must have write access for the UID and GID defined above -VOLUME [ "$DATA_DIR", "$CONFIG_DIR", "$BACKUPS_DIR" ] - -# override some default configuration options using env vars -ENV SFTPGO_CONFIG_DIR=${CONFIG_DIR} -# setting SFTPGO_LOG_FILE_PATH to an empty string will log to stdout -ENV SFTPGO_LOG_FILE_PATH="" -ENV SFTPGO_HTTPD__BIND_ADDRESS="" -ENV SFTPGO_HTTPD__TEMPLATES_PATH=${WEB_DIR}/templates -ENV SFTPGO_HTTPD__STATIC_FILES_PATH=${WEB_DIR}/static -ENV SFTPGO_DATA_PROVIDER__USERS_BASE_DIR=${DATA_DIR} -ENV SFTPGO_HTTPD__BACKUPS_PATH=${BACKUPS_DIR} - -# uncomment the following settings to enable FTP support -#ENV SFTPGO_FTPD__BIND_PORT=2121 -#ENV SFTPGO_FTPD__FORCE_PASSIVE_IP= -#EXPOSE 2121 -# we need to expose the passive ports range too -#EXPOSE 50000-50100 - -# it is a good idea to provide certificates to enable FTPS too -#ENV SFTPGO_FTPD__CERTIFICATE_FILE=${CONFIG_DIR}/mycert.crt -#ENV SFTPGO_FTPD__CERTIFICATE_KEY_FILE=${CONFIG_DIR}/mycert.key - -# uncomment the following setting to enable WebDAV support -#ENV SFTPGO_WEBDAVD__BIND_PORT=8090 - -# it is a good idea to provide certificates to enable WebDAV over HTTPS -#ENV SFTPGO_WEBDAVD__CERTIFICATE_FILE=${CONFIG_DIR}/mycert.crt -#ENV SFTPGO_WEBDAVD__CERTIFICATE_KEY_FILE=${CONFIG_DIR}/mycert.key - -ENTRYPOINT ["sftpgo"] -CMD ["serve"] diff --git a/docker/sftpgo/debian/README.md b/docker/sftpgo/debian/README.md deleted file mode 100644 index 4bb5fe48..00000000 --- a/docker/sftpgo/debian/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# Dockerfile based on Debian stable - -:warning: The recommended way to run SFTPGo on Docker is to use the official [images](https://hub.docker.com/r/drakkan/sftpgo). The documentation here is now obsolete. - -Please read the comments inside the `Dockerfile` to learn how to customize things for your setup. - -You can build the container image using `docker build`, for example: - -```bash -docker build -t="drakkan/sftpgo" . -``` - -This will build master of github.com/drakkan/sftpgo. - -To build the latest tag you can add `--build-arg TAG=LATEST` and to build a specific tag/commit you can use for example `TAG=v1.0.0`, like this: - -```bash -docker build -t="drakkan/sftpgo" --build-arg TAG=v1.0.0 . -``` - -To specify the features to build you can add `--build-arg FEATURES=`. For example you can disable SQLite and S3 support like this: - -```bash -docker build -t="drakkan/sftpgo" --build-arg FEATURES=nosqlite,nos3 . -``` - -Please take a look at the [build from source](./../../../docs/build-from-source.md) documentation for the complete list of the features that can be disabled. - -Now create the required folders on the host system, for example: - -```bash -sudo mkdir -p /srv/sftpgo/data /srv/sftpgo/config /srv/sftpgo/backups -``` - -and give write access to them to the UID/GID defined inside the `Dockerfile`. You can choose to create a new user, on the host system, with a matching UID/GID pair, or simply do something like this: - -```bash -sudo chown -R : /srv/sftpgo/data /srv/sftpgo/config /srv/sftpgo/backups -``` - -Download the default configuration file and edit it as you need: - -```bash -sudo curl https://raw.githubusercontent.com/drakkan/sftpgo/master/sftpgo.json -o /srv/sftpgo/config/sftpgo.json -``` - -Initialize the configured provider. For PostgreSQL and MySQL providers you need to create the configured database and the `initprovider` command will create the required tables: - -```bash -docker run --name sftpgo --mount type=bind,source=/srv/sftpgo/config,target=/app/config drakkan/sftpgo initprovider -c /app/config -``` - -and finally you can run the image using something like this: - -```bash -docker rm sftpgo && docker run --name sftpgo -p 8080:8080 -p 2022:2022 --mount type=bind,source=/srv/sftpgo/data,target=/app/data --mount type=bind,source=/srv/sftpgo/config,target=/app/config --mount type=bind,source=/srv/sftpgo/backups,target=/app/backups drakkan/sftpgo -``` - -If you want to enable FTP/S you also need the publish the FTP port and the FTP passive port range, defined in your `Dockerfile`, by adding, for example, the following options to the `docker run` command `-p 2121:2121 -p 50000-50100:50000-50100`. The same goes for WebDAV, you need to publish the configured port.