Improve docker build process and doc
This commit is contained in:
@@ -80,11 +80,11 @@ For more info, see [the public repository](https://hub.docker.com/r/kamax/mxisd/
|
||||
### From source
|
||||
[Build mxisd](#build) then build the docker image:
|
||||
```
|
||||
docker build -t your-org/mxisd:$(git describe --tags --always --dirty) .
|
||||
./gradlew dockerBuild
|
||||
```
|
||||
You can run a container of the given image and test it with the following command (adapt volumes host paths):
|
||||
```
|
||||
docker run -v /data/mxisd/etc:/etc/mxisd -v /data/mxisd/var:/var/mxisd -p 8090:8090 -t your-org/mxisd:$(git describe --tags --always --dirty)
|
||||
docker run -v /data/mxisd/etc:/etc/mxisd -v /data/mxisd/var:/var/mxisd -p 8090:8090 -t kamax/mxisd:latest-dev
|
||||
```
|
||||
|
||||
# From Source
|
||||
|
13
build.gradle
13
build.gradle
@@ -40,6 +40,9 @@ def debBuildConfPath = "${debBuildBasePath}${debConfPath}"
|
||||
def debBuildDataPath = "${debBuildBasePath}${debDataPath}"
|
||||
def debBuildSystemdPath = "${debBuildBasePath}${debSystemdPath}"
|
||||
|
||||
def dockerImageName = "kamax/mxisd"
|
||||
def dockerImageTag = "${dockerImageName}:${gitVersion()}"
|
||||
|
||||
String gitVersion() {
|
||||
def versionPattern = Pattern.compile("v(\\d+\\.)?(\\d+\\.)?(\\d+)(-.*)?")
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream()
|
||||
@@ -218,9 +221,15 @@ task buildDeb(dependsOn: build) {
|
||||
}
|
||||
|
||||
task dockerBuild(type: Exec, dependsOn: build) {
|
||||
commandLine 'docker', 'build', '-t', "kamax/mxisd:${gitVersion()}", project.rootDir
|
||||
commandLine 'docker', 'build', '-t', dockerImageTag, project.rootDir
|
||||
|
||||
doLast {
|
||||
exec {
|
||||
commandLine 'docker', 'tag', dockerImageTag, "${dockerImageName}:latest-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task dockerPush(type: Exec) {
|
||||
commandLine 'docker', 'push', "kamax/mxisd:${gitVersion()}"
|
||||
commandLine 'docker', 'push', dockerImageTag
|
||||
}
|
||||
|
Reference in New Issue
Block a user