-
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.
CI: add automatic docker container builds
Also: - fix file compression in build workflow - was using xz extension with gzip format - made the installer script a little more robust. It handles gzip assets now - Add some workflow badges to the readme
- Loading branch information
Showing
7 changed files
with
114 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: publish docker | ||
|
||
on: | ||
release: | ||
types: [published] | ||
# Manual trigger of a release | ||
workflow_dispatch: | ||
inputs: | ||
name: | ||
description: "Reason" | ||
required: true | ||
default: "" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
lfs: false | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Run the build script | ||
shell: pwsh | ||
run: | | ||
$version = gh release view --json tagName,targetCommitish | ConvertFrom-Json | ||
$version | Write-Output | ||
./build/build_and_push -version $version.tagName -commit $version.targetCommitish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
@@ -1,21 +1,23 @@ | ||
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" | ||
# syntax=docker/dockerfile:1.2 | ||
|
||
FROM debian:stretch-slim | ||
|
||
ARG GIT_COMMIT="" | ||
ARG AP_VERSION="" | ||
ARG CREATION_DATE="" | ||
|
||
LABEL \ | ||
info.ecoacoustics.qut.ap.created=${CREATION_DATE} \ | ||
info.ecoacoustics.qut.ap.authors="Anthony Truskinger <[email protected]>" \ | ||
info.ecoacoustics.qut.ap.url="https://github.com/QutEcoacoustics/audio-analysis" \ | ||
info.ecoacoustics.qut.ap.documentation="https://ap.qut.ecoacoustics.info/" \ | ||
info.ecoacoustics.qut.ap.source="https://github.com/QutEcoacoustics/audio-analysis/blob/master/build/Dockerfile" \ | ||
info.ecoacoustics.qut.ap.version="${AP_VERSION}" \ | ||
info.ecoacoustics.qut.ap.revision=${GIT_COMMIT} \ | ||
info.ecoacoustics.qut.ap.vendor="QUT Ecoacoustics" \ | ||
info.ecoacoustics.qut.ap.licenses="Apache-2.0" \ | ||
info.ecoacoustics.qut.ap.title="AnalysisPrograms.exe" \ | ||
info.ecoacoustics.qut.ap.description="Debian environment for running AnalysisPrograms.exe" | ||
|
||
# Install system components (used by powershell. and AP as well) | ||
RUN apt-get update && apt-get install -y curl gnupg apt-transport-https unzip \ | ||
|
@@ -33,7 +35,7 @@ RUN add-apt-repository "deb http://mp3splt.sourceforge.net/repository unstable m | |
|
||
# Powershell | ||
RUN \ | ||
# Import the public repository GPG keys | ||
# 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 \ | ||
|
@@ -44,6 +46,8 @@ RUN \ | |
|
||
# Install AP.exe | ||
ADD download_ap.ps1 /download_ap.ps1 | ||
RUN /usr/bin/pwsh -NonInteractive -c "/download_ap.ps1 ${AP_SOURCE} -version ${AP_VERSION}" | ||
RUN --mount=type=secret,id=GITHUB_AUTH_TOKEN \ | ||
/usr/bin/pwsh -NonInteractive -c \ | ||
'/download_ap.ps1 -Install -version "${AP_VERSION}" -GithubApiToken "$(Get-Content -Raw /run/secrets/GITHUB_AUTH_TOKEN)"' | ||
|
||
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 |
---|---|---|
@@ -1,27 +1,39 @@ | ||
#!/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)] | ||
[Parameter(Mandatory = $true)] | ||
[string] | ||
$version | ||
$version, | ||
|
||
$commit | ||
) | ||
. $PSScriptRoot/log.ps1 | ||
|
||
log "Resolving commit '$commit'" | ||
|
||
# get the current git commit | ||
$GIT_COMMIT=git log -1 --format=%H | ||
# this will resolve a name (like master/main) into a hash id | ||
# and will return current commit id if empty reference provided | ||
$commit = git log -1 --format=%H "$commit" | ||
|
||
log "Commit resolved to '$commit'" | ||
|
||
$env:DOCKER_BUILDKIT=1 | ||
|
||
log "Building container" "Building" | ||
|
||
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 | ||
--build-arg GIT_COMMIT=$commit ` | ||
--build-arg AP_VERSION=$version ` | ||
--build-arg CREATION_DATE=((Get-Date ).ToString("O")) | ||
--secret id=GITHUB_AUTH_TOKEN,env=GITHUB_AUTH_TOKEN | ||
|
||
log "Pushing container" "Pushing" | ||
|
||
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
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