Docker workflow: explicitly set image labels

while waiting for https://github.com/docker/build-push-action/issues/165
to be fixed.

Some minor changes to the default configuration for Linux packages
This commit is contained in:
Nicola Murino 2020-10-06 18:03:55 +02:00
parent 87f78b07b3
commit c289ae07d2
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB
5 changed files with 18 additions and 17 deletions

View file

@ -69,9 +69,10 @@ jobs:
labels: | labels: |
org.opencontainers.image.title=SFTPGo 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.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.url=https://github.com/users/drakkan/packages/container/package/sftpgo
org.opencontainers.image.source=${{ github.event.repository.clone_url }} 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.version=${{ steps.info.outputs.version }}
org.opencontainers.image.created=${{ steps.info.outputs.created }} org.opencontainers.image.created=${{ steps.info.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} org.opencontainers.image.licenses=GPL-3.0

View file

@ -25,9 +25,6 @@ FROM alpine:3.12
RUN apk add --update --no-cache ca-certificates tzdata bash 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"] SHELL ["/bin/bash", "-c"]
# set up nsswitch.conf for Go's "netgo" implementation # 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 addgroup -g 1000 -S sftpgo
RUN adduser -u 1000 -h /var/lib/sftpgo -s /sbin/nologin -G sftpgo -S -D -H 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 # Override some configuration details
ENV SFTPGO_CONFIG_DIR=/etc/sftpgo ENV SFTPGO_CONFIG_DIR=/etc/sftpgo
ENV SFTPGO_LOG_FILE_PATH="" ENV SFTPGO_LOG_FILE_PATH=""

View file

@ -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: 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. - 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. - 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: 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: 2. Start your SFTPGo container like this:
```shell ```shell
docker run --name sftpgo_edge \ docker run --name some-sftpgo \
-p 127.0.0.1:8080:8090 \ -p 127.0.0.1:8080:8090 \
-p 2022:2022 \ -p 2022:2022 \
--mount type=bind,source=/my/own/sftpgodata,target=/var/lib/sftpgo \ --mount type=bind,source=/my/own/sftpgodata,target=/var/lib/sftpgo \

View file

@ -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 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` - 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.

View file

@ -17,13 +17,14 @@ echo -n ${VERSION} > dist/version
cd dist cd dist
BASE_DIR="../.." 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 . 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 completion bash > sftpgo-completion.bash
$BASE_DIR/sftpgo gen man -d man1 $BASE_DIR/sftpgo gen man -d man1
@ -47,7 +48,6 @@ homepage: "https://github.com/drakkan/sftpgo"
license: "GPL-3.0" license: "GPL-3.0"
files: files:
${BASE_DIR}/sftpgo: "/usr/bin/sftpgo" ${BASE_DIR}/sftpgo: "/usr/bin/sftpgo"
./sftpgo.env: "/etc/sftpgo/sftpgo.env"
./sftpgo-completion.bash: "/etc/bash_completion.d/sftpgo-completion.bash" ./sftpgo-completion.bash: "/etc/bash_completion.d/sftpgo-completion.bash"
./man1/*: "/usr/share/man/man1/" ./man1/*: "/usr/share/man/man1/"
${BASE_DIR}/init/sftpgo.service: "/lib/systemd/system/sftpgo.service" ${BASE_DIR}/init/sftpgo.service: "/lib/systemd/system/sftpgo.service"