Add builder Dockerfile and steps in CI

This commit is contained in:
Joshua M. Boniface 2020-06-14 19:23:27 -04:00
parent 4e4c5b1400
commit 95be2ba211
2 changed files with 60 additions and 2 deletions

View file

@ -1,6 +1,6 @@
jobs:
- job: Package
displayName: 'Package'
- job: BuildPackage
displayName: 'Build Packages'
strategy:
matrix:
@ -45,6 +45,53 @@ jobs:
contents: '**'
targetFolder: '/srv/repository/incoming/azure/$(Build.BuildNumber)/$(BuildConfiguration)'
- job: BuildDocker
displayName: 'Build Docker'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: 'docker build -f deployment/Dockerfile.docker -t jellyfin-web-unstable .'
displayName: 'Build Dockerfile (unstable)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package')
- script: 'docker build -f deployment/Dockerfile.docker -t jellyfin-web-stable .'
displayName: 'Build Dockerfile (stable)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
- script: 'docker push "jellyfin-web-unstable":"$(Build.BuildNumber)-all"'
displayName: 'Push Docker image (unstable)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package')
- script: 'docker push "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )-all"'
displayName: 'Push Docker image (stable)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
- script: 'docker manifest create --amend "jellyfin-web-unstable":"$(Build.BuildNumber)" "jellyfin-web-unstable":"$(Build.BuildNumber)"'
displayName: 'Create Docker manifest (unstable)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package')
- script: 'docker manifest create --amend "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )" "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )-all"'
displayName: 'Create Docker manifest (stable, versioned)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
- script: 'docker manifest create --amend "jellyfin-web-stable":"latest" "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )-all"'
displayName: 'Create Docker manifest (stable, latest)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
- script: 'docker manifest push --purge "jellyfin-web-unstable":"$(Build.BuildNumber)"'
displayName: 'Push Docker manifest (unstable)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package')
- script: 'docker manifest push --purge "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )"'
displayName: 'Push Docker manifest (stable, versioned)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
- script: 'docker manifest push --purge "jellyfin-web-stable":"latest"'
displayName: 'Push Docker manifest (stable, latest)'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
- job: Collect
displayName: 'Collect Artifacts'

View file

@ -0,0 +1,11 @@
FROM node:alpine
ARG SOURCE_DIR=/src
ARG ARTIFACT_DIR=/jellyfin-web
RUN apk add autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python
WORKDIR ${SOURCE_DIR}/
COPY . .
RUN yarn install && mv dist ${ARTIFACT_DIR}