mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-25 00:50:31 +00:00
docker: add some docs and build for arm64 too
This commit is contained in:
parent
5e2db77ef9
commit
87f78b07b3
6 changed files with 57 additions and 18 deletions
3
.github/workflows/docker.yml
vendored
3
.github/workflows/docker.yml
vendored
|
@ -2,7 +2,7 @@ name: Docker
|
|||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 10 * * *' # everyday at 10am
|
||||
- cron: '0 4 * * *' # everyday at 4 am UTC
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
@ -65,6 +65,7 @@ jobs:
|
|||
tags: ${{ steps.info.outputs.tags }}
|
||||
build-args: |
|
||||
COMMIT_SHA=${{ steps.info.outputs.sha }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
labels: |
|
||||
org.opencontainers.image.title=SFTPGo
|
||||
org.opencontainers.image.description=Fully featured and highly configurable SFTP server with optional FTP/S and WebDAV support
|
||||
|
|
13
Dockerfile
13
Dockerfile
|
@ -25,6 +25,9 @@ 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
|
||||
|
@ -36,9 +39,6 @@ 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=""
|
||||
|
@ -50,6 +50,7 @@ ENV SFTPGO_DATA_PROVIDER__USERS_BASE_DIR=/var/lib/sftpgo/users
|
|||
ENV SFTPGO_DATA_PROVIDER__CREDENTIALS_PATH=/var/lib/sftpgo/credentials
|
||||
ENV SFTPGO_HTTPD__BACKUPS_PATH=/var/lib/sftpgo/backups
|
||||
ENV SFTPGO_SFTPD__HOST_KEYS=/var/lib/sftpgo/host_keys/id_rsa,/var/lib/sftpgo/host_keys/id_ecdsa
|
||||
ENV SFTPGO_HTTPD__BIND_ADDRESS=""
|
||||
|
||||
COPY --from=builder /workspace/sftpgo.json /etc/sftpgo/sftpgo.json
|
||||
COPY --from=builder /workspace/templates /usr/share/sftpgo/templates
|
||||
|
@ -58,9 +59,9 @@ COPY --from=builder /workspace/sftpgo /usr/local/bin/
|
|||
|
||||
RUN sed -i "s|sftpgo.db|/var/lib/sftpgo/sftpgo.db|" /etc/sftpgo/sftpgo.json
|
||||
|
||||
RUN chown -R sftpgo:sftpgo /etc/sftpgo /var/lib/sftpgo
|
||||
RUN chmod 750 /etc/sftpgo /var/lib/sftpgo
|
||||
RUN chmod 640 /etc/sftpgo/sftpgo.json
|
||||
RUN chown -R sftpgo:sftpgo /etc/sftpgo && chown sftpgo:sftpgo /var/lib/sftpgo && \
|
||||
chmod 640 /etc/sftpgo/sftpgo.json && \
|
||||
chmod 750 /etc/sftpgo /var/lib/sftpgo
|
||||
|
||||
USER sftpgo
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ SFTPGo is developed and tested on Linux. After each commit, the code is automati
|
|||
|
||||
Binary releases for Linux, macOS, and Windows are available. Please visit the [releases](https://github.com/drakkan/sftpgo/releases "releases") page.
|
||||
|
||||
Sample Dockerfiles for [Debian](https://www.debian.org) and [Alpine](https://alpinelinux.org) are available inside the source tree [docker](./docker) directory.
|
||||
Official Docker images are available. Documentation is [here](./docker/README.md).
|
||||
|
||||
Some Linux distro packages are available:
|
||||
|
||||
|
@ -92,7 +92,7 @@ Check out [this documentation](./docs/service.md) if you want to run SFTPGo as a
|
|||
|
||||
### Data provider initialization and update
|
||||
|
||||
Before starting the SFTPGo server, please ensure that the configured data provider is properly initialized/updated.
|
||||
Before starting the SFTPGo server please ensure that the configured data provider is properly initialized/updated.
|
||||
|
||||
SQL based data providers (SQLite, MySQL, PostgreSQL) require the creation of a database containing the required tables. Memory and bolt data providers do not require an initialization but they could require an update to the existing data after upgrading SFTPGo.
|
||||
|
||||
|
@ -114,7 +114,7 @@ Take a look at the CLI usage to learn how to specify a different configuration f
|
|||
sftpgo initprovider --help
|
||||
```
|
||||
|
||||
You can also disable automatic data provider checks at startup setting the `update_mode` configuration key to `1`.
|
||||
You can disable automatic data provider checks/updates at startup by setting the `update_mode` configuration key to `1`.
|
||||
|
||||
## Tutorials
|
||||
|
||||
|
|
|
@ -1,17 +1,50 @@
|
|||
# Dockerfile examples
|
||||
# Official Docker images
|
||||
|
||||
Sample Dockerfiles for the SFTPGo daemon and the REST API CLI.
|
||||
SFTPGo provides official Docker images. They are available [here](https://github.com/users/drakkan/packages/container/package/sftpgo).
|
||||
|
||||
The SFTPGo Dockerfiles for `Debian` and `Alpine` are multi-stage builds, you can customize your build configuration using the pre-defined build arguments. For example the following build argument is defined for both `Debian` and `Alpine`:
|
||||
## Start a SFTPGo server instance
|
||||
|
||||
```console
|
||||
ARG TAG
|
||||
Starting a SFTPGo instance is simple:
|
||||
|
||||
```shell
|
||||
docker run --name some-sftpgo -p 127.0.0.1:8080:8080 -p 2022:2022 -d "ghcr.io/drakkan/sftpgo:edge"
|
||||
```
|
||||
|
||||
you can build a specific tag/commit passing, for example, `--build-arg TAG=v1.0.0` to the `docker build` command, please take a look at the specific `Dockerfile` to see all the available build args.
|
||||
Now visit [http://localhost:8080/](http://localhost:8080/) and create a new SFTPGo user. The SFTP service is available on port 2022.
|
||||
|
||||
The runtime configuration can be customized via environment variables that you can set directly inside the `Dockerfile` (not recommended) or passing the `-e` option to the `docker run` command or inside the `environment` section if you are using [docker stack deploy](https://docs.docker.com/engine/reference/commandline/stack_deploy/) or [docker-compose](https://github.com/docker/compose).
|
||||
## LOG
|
||||
|
||||
The logs are available through Docker's container log:
|
||||
|
||||
```shell
|
||||
docker logs some-sftpgo
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The runtime configuration can be customized via environment variables that you can set passing the `-e` option to the `docker run` command or inside the `environment` section if you are using [docker stack deploy](https://docs.docker.com/engine/reference/commandline/stack_deploy/) or [docker-compose](https://github.com/docker/compose).
|
||||
|
||||
Please take a look [here](../docs/full-configuration.md#environment-variables) to learn how to configure SFTPGo via environment variables.
|
||||
|
||||
I'm not a `Docker` expert, you can use the provided Dockerfiles as starting point, if you think they can improved to be more general or you want to improve the documentation please send pull requests, thank you!
|
||||
## Where to Store Data
|
||||
|
||||
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.
|
||||
|
||||
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:
|
||||
|
||||
1. Create a data directory on a suitable volume on your host system, e.g. `/my/own/sftpgodata`.
|
||||
2. Start your SFTPGo container like this:
|
||||
|
||||
```shell
|
||||
docker run --name sftpgo_edge \
|
||||
-p 127.0.0.1:8080:8090 \
|
||||
-p 2022:2022 \
|
||||
--mount type=bind,source=/my/own/sftpgodata,target=/var/lib/sftpgo \
|
||||
-e SFTPGO_HTTPD__BIND_PORT=8090 \
|
||||
-d "ghcr.io/drakkan/sftpgo:edge"
|
||||
```
|
||||
|
||||
The `--mount type=bind,source=/my/own/sftpgodata,target=/var/lib/sftpgo` part of the command mounts the `/my/own/sftpgodata` directory from the underlying host system as `/var/lib/sftpgo` inside the container, where SFTPGo will store its data.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# SFTPGo with Docker and Alpine
|
||||
|
||||
:warning: The recommended way to run SFTPGo on Docker is to use the official [images](https://github.com/users/drakkan/packages/container/package/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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Dockerfile based on Debian stable
|
||||
|
||||
:warning: The recommended way to run SFTPGo on Docker is to use the official [images](https://github.com/users/drakkan/packages/container/package/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:
|
||||
|
|
Loading…
Reference in a new issue