mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-25 17:10:28 +00:00
a40fa93d7b
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
2.1 KiB
2.1 KiB
Build SFTPGo from source
Download the sources and use go build
.
The following build tags are available:
nogcs
, disable Google Cloud Storage backend, default enablednos3
, disable S3 Compabible Object Storage backends, default enablednoazblob
, disable Azure Blob Storage backend, default enablednobolt
, disable Bolt data provider, default enablednomysql
, disable MySQL data provider, default enablednopgsql
, disable PostgreSQL data provider, default enablednosqlite
, disable SQLite data provider, default enablednoportable
, disable portable mode, default enablednometrics
, disable Prometheus metrics, default enabledbundle
, embed static files and templates. Before building with this tag enabled you have to copyopenapi
,static
andtemplates
dirs tointernal/bundle
directory. Default disabled
If no build tag is specified the build will include the default features.
The optional SQLite driver is a CGO
package and so it requires a C
compiler at build time.
On Linux and macOS, a compiler is easy to install or already installed. On Windows, you need to download MinGW-w64 and build SFTPGo from its command prompt.
The compiler is a build time only dependency. It is not required at runtime.
Version info, such as git commit and build date, can be embedded setting the following string variables at build time:
github.com/drakkan/sftpgo/v2/internal/version.commit
github.com/drakkan/sftpgo/v2/internal/version.date
For example, you can build using the following command:
go build -tags nogcs,nos3,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/internal/version.commit=`git describe --always --abbrev=8 --dirty` -X github.com/drakkan/sftpgo/v2/internal/version.date=`date -u +%FT%TZ`" -o sftpgo
You should get a version that includes git commit, build date and available features like this one:
$ ./sftpgo -v
SFTPGo 2.3.1-dev-c8158e1-2022-07-24T17:25:45Z +metrics +azblob +gcs +s3 +bolt +mysql +pgsql +sqlite +portable