diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 332b8ab4..0b162024 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -69,9 +69,10 @@ jobs: labels: | org.opencontainers.image.title=SFTPGo org.opencontainers.image.description=Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support - org.opencontainers.image.url=${{ github.event.repository.html_url }} - org.opencontainers.image.source=${{ github.event.repository.clone_url }} + org.opencontainers.image.url=https://github.com/users/drakkan/packages/container/package/sftpgo + org.opencontainers.image.documentation=https://github.com/drakkan/sftpgo/blob/master/docker/README.md + org.opencontainers.image.source=https://github.com/drakkan/sftpgo.git org.opencontainers.image.version=${{ steps.info.outputs.version }} org.opencontainers.image.created=${{ steps.info.outputs.created }} org.opencontainers.image.revision=${{ github.sha }} - org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} + org.opencontainers.image.licenses=GPL-3.0 diff --git a/Dockerfile b/Dockerfile index 08eeca98..8b30a99c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,9 +25,6 @@ FROM alpine:3.12 RUN apk add --update --no-cache ca-certificates tzdata bash -# Install some optional packages used by SFTPGo features -RUN apk add --update --no-cache rsync git mailcap - SHELL ["/bin/bash", "-c"] # set up nsswitch.conf for Go's "netgo" implementation @@ -39,6 +36,9 @@ RUN mkdir -p /etc/sftpgo /var/lib/sftpgo /usr/share/sftpgo RUN addgroup -g 1000 -S sftpgo RUN adduser -u 1000 -h /var/lib/sftpgo -s /sbin/nologin -G sftpgo -S -D -H sftpgo +# Install some optional packages used by SFTPGo features +RUN apk add --update --no-cache rsync git mailcap + # Override some configuration details ENV SFTPGO_CONFIG_DIR=/etc/sftpgo ENV SFTPGO_LOG_FILE_PATH="" diff --git a/docker/README.md b/docker/README.md index 99818023..76f11223 100644 --- a/docker/README.md +++ b/docker/README.md @@ -30,8 +30,8 @@ Please take a look [here](../docs/full-configuration.md#environment-variables) t Important note: There are several ways to store data used by applications that run in Docker containers. We encourage users of the SFTPGo images to familiarize themselves with the options available, including: -- Let Docker manage the storage for SFTPGo data by writing them to disk on the host system using its own internal [volume management](https://docs.docker.com/engine/tutorials/dockervolumes/#adding-a-data-volume). This is the default and is easy and fairly transparent to the user. The downside is that the files may be hard to locate for tools and applications that run directly on the host system, i.e. outside containers. -- Create a data directory on the host system (outside the container) and mount this to a directory visible from inside the container. This places the SFTPGo files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The downside is that the user needs to make sure that the directory exists, and that e.g. directory permissions and other security mechanisms on the host system are set up correctly. The SFTPGo images run using `1000` as uid and gid. +- Let Docker manage the storage for SFTPGo data by [writing them to disk on the host system using its own internal volume management](https://docs.docker.com/engine/tutorials/dockervolumes/#adding-a-data-volume). This is the default and is easy and fairly transparent to the user. The downside is that the files may be hard to locate for tools and applications that run directly on the host system, i.e. outside containers. +- Create a data directory on the host system (outside the container) and [mount this to a directory visible from inside the container]((https://docs.docker.com/engine/tutorials/dockervolumes/#mount-a-host-directory-as-a-data-volume)). This places the SFTPGo files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The downside is that the user needs to make sure that the directory exists, and that e.g. directory permissions and other security mechanisms on the host system are set up correctly. The SFTPGo images run using `1000` as uid and gid. The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blogs and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above: @@ -39,7 +39,7 @@ The Docker documentation is a good starting point for understanding the differen 2. Start your SFTPGo container like this: ```shell -docker run --name sftpgo_edge \ +docker run --name some-sftpgo \ -p 127.0.0.1:8080:8090 \ -p 2022:2022 \ --mount type=bind,source=/my/own/sftpgodata,target=/var/lib/sftpgo \ diff --git a/docs/full-configuration.md b/docs/full-configuration.md index d6c05ac7..0158235e 100644 --- a/docs/full-configuration.md +++ b/docs/full-configuration.md @@ -194,4 +194,4 @@ Let's see some examples: - To set sftpd `bind_port`, you need to define the env var `SFTPGO_SFTPD__BIND_PORT` - To set the `execute_on` actions, you need to define the env var `SFTPGO_COMMON__ACTIONS__EXECUTE_ON`. For example `SFTPGO_COMMON__ACTIONS__EXECUTE_ON=upload,download` -Please note that, to override configuration options with environment variables, a configuration file containing the options to override is required, this is a [viper bug](https://github.com/spf13/viper/issues/584). You can, for example, deploy the default configuration file and then override the options you need to customize using environment variables. +Please note that in order to override configuration options with environment variables, you need a configuration file containing the options to override, this is a [viper bug](https://github.com/spf13/viper/issues/584). For example, you can deploy the default configuration file and then override the options to customize using environment variables. diff --git a/pkgs/build.sh b/pkgs/build.sh index 06969e54..2f6b0250 100755 --- a/pkgs/build.sh +++ b/pkgs/build.sh @@ -17,13 +17,14 @@ echo -n ${VERSION} > dist/version cd dist BASE_DIR="../.." -echo "SFTPGO_HTTPD__TEMPLATES_PATH=/usr/share/sftpgo/templates" > sftpgo.env -echo "SFTPGO_HTTPD__STATIC_FILES_PATH=/usr/share/sftpgo/static" >> sftpgo.env -echo "SFTPGO_HTTPD__BACKUPS_PATH=/var/lib/sftpgo/backups" >> sftpgo.env -echo "SFTPGO_DATA_PROVIDER__CREDENTIALS_PATH=/var/lib/sftpgo/credentials" >> sftpgo.env - cp ${BASE_DIR}/sftpgo.json . -sed -i 's/sftpgo.db/\/var\/lib\/sftpgo\/sftpgo.db/g' sftpgo.json +sed -i "s|sftpgo.db|/var/lib/sftpgo/sftpgo.db|" sftpgo.json +sed -i "s|\"users_base_dir\": \"\",|\"users_base_dir\": \"/var/lib/sftpgo/users\",|" sftpgo.json +sed -i "s|\"templates\"|\"/usr/share/sftpgo/templates\"|" sftpgo.json +sed -i "s|\"static\"|\"/usr/share/sftpgo/static\"|" sftpgo.json +sed -i "s|\"backups\"|\"/var/lib/sftpgo/backups\"|" sftpgo.json +sed -i "s|\"credentials\"|\"/var/lib/sftpgo/credentials\"|" sftpgo.json + $BASE_DIR/sftpgo gen completion bash > sftpgo-completion.bash $BASE_DIR/sftpgo gen man -d man1 @@ -47,7 +48,6 @@ homepage: "https://github.com/drakkan/sftpgo" license: "GPL-3.0" files: ${BASE_DIR}/sftpgo: "/usr/bin/sftpgo" - ./sftpgo.env: "/etc/sftpgo/sftpgo.env" ./sftpgo-completion.bash: "/etc/bash_completion.d/sftpgo-completion.bash" ./man1/*: "/usr/share/man/man1/" ${BASE_DIR}/init/sftpgo.service: "/lib/systemd/system/sftpgo.service"