-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/QutEcoacoustics/audio-ana…
- Loading branch information
Showing
11 changed files
with
247 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
FROM debian:stretch-slim | ||
|
||
ARG GIT_COMMIT | ||
ARG AP_SOURCE="github" | ||
ARG AP_VERSION="latest" | ||
|
||
LABEL maintainer="Anthony Truskinger <[email protected]>" \ | ||
description="Debian environment for running AnalysisPrograms.exe" \ | ||
version="1.0" \ | ||
org.ecosounds.name="AnalysisPrograms.exe" \ | ||
org.ecosounds.version=${AP_VERSION} \ | ||
org.ecosounds.vendor="QUT Ecoacoustics" \ | ||
org.ecosounds.url="https://github.com/QutEcoacoustics/audio-analysis" \ | ||
org.ecosounds.vcs-url="https://github.com/QutEcoacoustics/audio-analysis" \ | ||
org.ecosounds.vcs-ref=${GIT_COMMIT} \ | ||
org.ecosounds.schema-version="1.0" | ||
|
||
|
||
|
||
# Install system components (used by powershell. and AP as well) | ||
RUN apt-get update && apt-get install -y curl gnupg apt-transport-https unzip \ | ||
readline-common software-properties-common \ | ||
wavpack libsox-fmt-all sox shntool libav-tools ffmpeg \ | ||
# link ffmpeg to /usr/bin/local | ||
&& ln -s /usr/bin/ffmpeg /usr/local/bin/ffmpeg \ | ||
&& ln -s /usr/bin/ffprobe /usr/local/bin/ffprobe | ||
|
||
# install mp3splt | ||
RUN add-apt-repository "deb http://mp3splt.sourceforge.net/repository unstable main" \ | ||
&& apt-get update --allow-unauthenticated \ | ||
&& apt-get -y --allow-unauthenticated install libmp3splt0-mp3 libmp3splt0-ogg libmp3splt0-flac libmp3splt-doc libmp3splt-dev mp3splt mp3splt-gtk | ||
|
||
# Mono | ||
RUN \ | ||
# Add mono key server | ||
curl https://origin-download.mono-project.com/repo/xamarin.gpg | apt-key add - \ | ||
# install mono | ||
echo "deb http://download.mono-project.com/repo/debian stable-stretch main" | tee /etc/apt/sources.list.d/mono-official-stable.list \ | ||
&& apt-get update \ | ||
&& apt-get install -y mono-complete \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* | ||
|
||
# Powershell | ||
RUN \ | ||
# Import the public repository GPG keys | ||
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ | ||
# Register the Microsoft Product feed | ||
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list \ | ||
# Update the list of products | ||
&& apt-get update \ | ||
# Install PowerShell | ||
&& apt-get install -y --no-install-recommends powershell | ||
|
||
# Install AP.exe | ||
ADD download_ap.ps1 /download_ap.ps1 | ||
RUN /usr/bin/pwsh -NonInteractive -c "/download_ap.ps1 ${AP_SOURCE} -version ${AP_VERSION}" | ||
|
||
ENTRYPOINT [ "/bin/bash" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/pwsh | ||
|
||
# builds and pushes a docker file to docker hub | ||
# currently only builds the 'stable' tag, which is applied to whatever version | ||
# is supplied to this script. | ||
# Future work: allow this script to build our 'Weekly' and 'Continuous' lines | ||
# as their own containers. | ||
param( | ||
# Version tag | ||
[Parameter(Mandatory=$true)] | ||
[string] | ||
$version | ||
) | ||
|
||
# get the current git commit | ||
$GIT_COMMIT=git log -1 --format=%H | ||
|
||
docker build ` | ||
-t qutecoacoustics/audio-analysis:stable ` | ||
-t qutecoacoustics/audio-analysis:latest ` | ||
-t qutecoacoustics/audio-analysis:$version ` | ||
. ` | ||
--build-arg GIT_COMMIT=$GIT_COMMIT ` | ||
--build-arg AP_SOURCE="github" ` | ||
--build-arg AP_VERSION=$version | ||
|
||
docker push qutecoacoustics/audio-analysis:stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#!/usr/bin/pwsh | ||
|
||
# Downloads bianry assets for AP.exe | ||
param( | ||
# the source to get the binary from either 'github' or 'appveyor' | ||
[Parameter(Position=0)] | ||
[ValidateSet('github','appveyor')] | ||
[string]$source, | ||
|
||
# The version to download. Use 'latest' to get the latest version. | ||
# Use an actual version number ('18.03.4.1') to get a speicific github version. | ||
# Use the AppVeyor build ID ('314') to get a specific appveyor build. | ||
[Parameter()] | ||
[string]$version = "latest", | ||
|
||
# Which build to get, either 'Debug' or 'Release', defaults to 'Release' | ||
[Parameter()] | ||
[ValidateSet('Release','Debug')] | ||
[string]$build = "Release", | ||
|
||
|
||
# Directory to extract binary to. Defaults to "/AP" ("C:\AP" on Windows) | ||
[Parameter()] | ||
[string]$destination = "/AP" | ||
) | ||
|
||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
|
||
# resolve metadata for asset | ||
if ($source -eq "github") { | ||
$github_url = "https://api.github.com/repos/QutEcoacoustics/audio-analysis/releases" | ||
if ($version -eq "latest") { | ||
$github_url += "/latest" | ||
} | ||
else { | ||
# strip the leading v if it is present | ||
$version = $version -replace "^v","" | ||
$github_url += "/tags/v$version" | ||
} | ||
|
||
$response = Invoke-RestMethod -Method Get -Uri $github_url | ||
$asset_url = $response.assets ` | ||
| Where-Object { $_.name -like "$build*" } ` | ||
| ForEach-Object browser_download_url | ||
Write-Output "Downloading release $($response.tag_name) from GitHub" | ||
} | ||
elseif ($source -eq "appveyor") { | ||
$appveyor_api = "https://ci.appveyor.com/api" | ||
$appveyor_project_url = "$appveyor_api/projects/QUTEcoacousticsResearchGroup/audio-analysis" | ||
|
||
# get the last 50 builds | ||
$response = Invoke-RestMethod -Method Get -Uri "$appveyor_project_url/history?recordsNumber=50" | ||
|
||
# filter builds for master branch and build success | ||
$ci_builds = $response.builds ` | ||
| Where-Object { $_.status -eq "success" -and $_.branch -eq "master" } ` | ||
| Sort-Object finished -Descending | ||
if ($version -eq "latest") { | ||
$ci_build = $ci_builds[0] | ||
} | ||
else { | ||
$ci_build = $ci_builds | Where-Object { $_.version -eq $version } | ||
} | ||
|
||
if ($null -eq $ci_build) { | ||
throw "could not find version '$version' in last 50 AppVeyor builds" | ||
} | ||
|
||
# now get the build (we need to do this again because the job sub-object) | ||
# is not included in the build objects when the history is retrieved | ||
$ci_build = (Invoke-RestMethod -Method Get -Uri "$appveyor_project_url/build/$($ci_build.version)").build | ||
$artifacts_url = "$appveyor_api/buildJobs/$($ci_build.jobs[0].jobId)/artifacts" | ||
$artifacts = Invoke-RestMethod -Method Get -Uri $artifacts_url | ||
|
||
$file_name = ($artifacts | Where-Object { $_.fileName -like "*$build*" }).fileName | ||
|
||
$asset_url = "$artifacts_url/$file_name" | ||
Write-Output "Downloading version $($ci_build.version) from AppVeyor" | ||
} | ||
else { | ||
throw "unknown source '$source'" | ||
} | ||
|
||
|
||
# remove directory if it already exists | ||
if (Test-Path $destination) { | ||
Write-Warning "Deleting old installation at '$destination'" | ||
Remove-Item $destination -Recurse -ErrorAction Stop | ||
Start-Sleep 1 | ||
} | ||
New-Item $destination -ItemType Directory -ErrorAction Stop | ||
|
||
try { | ||
Push-Location $destination | ||
|
||
# download asset using system native curl | ||
Write-Output "Downloading asset $asset_url" | ||
$curl = Get-Command curl* -CommandType Application | ||
& $curl -L -O "$asset_url" | ||
if ($LASTEXITCODE -ne 0) { | ||
throw "failed downloading $asset_url" | ||
} | ||
|
||
$downloaded_zip = Get-ChildItem "$build*.zip" | ||
|
||
unzip -o $downloaded_zip | ||
if ($LASTEXITCODE -ne 0) { | ||
throw "failed extracting zip $downloaded_zip" | ||
} | ||
|
||
Remove-Item $downloaded_zip | ||
|
||
Write-Output "Download complete, installed to $destination" | ||
|
||
} | ||
finally { | ||
Pop-Location | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters