This commit is contained in:
Gilles Boccon-Gibod
2020-01-05 22:47:57 -08:00
parent 628b31d7eb
commit 2dbb8cba46
2 changed files with 18 additions and 3 deletions

View File

@@ -17,6 +17,10 @@ RUN cd /tmp/bento4 && python3 Scripts/SdkPackager.py x86_64-unknown-linux . cmak
# === Second Stage ===
FROM alpine:latest
ARG BENTO4_VERSION
LABEL "com.example.vendor"="Axiomatic Systems, LLC."
LABEL version=$BENTO4_VERSION
LABEL maintainer="bok@bok.net"
# Setup environment variables
ENV PATH=/opt/bento4/bin:${PATH}

View File

@@ -1,6 +1,18 @@
import os
import re
from invoke import task
def get_version():
script_dir = os.path.abspath(os.path.dirname(__file__))
bento4_home = os.path.join(script_dir,'..')
with open(bento4_home + '/Source/C++/Core/Ap4Version.h') as f:
lines = f.readlines()
for line in lines:
m = re.match(r'.*AP4_VERSION_STRING *"([0-9]*)\.([0-9]*)\.([0-9]*).*"', line)
if m:
return m.group(1) + '.' + m.group(2) + '.' + m.group(3)
return '0.0.0'
def get_sdk_revision():
cmd = 'git status --porcelain -b'
lines = os.popen(cmd).readlines()
@@ -9,9 +21,8 @@ def get_sdk_revision():
print('WARNING: not on master branch')
branch = '+' + lines[0][3:].strip()
if len(lines) > 1:
print('ERROR: git status not empty')
print('WARNING: git status not empty')
print(''.join(lines))
return None
cmd = 'git tag --contains HEAD'
tags = os.popen(cmd).readlines()
@@ -26,5 +37,5 @@ def get_sdk_revision():
@task(default = True)
def build(ctx):
command = "echo docker image build -t bento4:{} -t bento4:latest -f Build/Docker/Dockerfile .".format(get_sdk_revision())
command = "docker image build -t bento4:{version}-{revision} -t bento4:latest --build-arg BENTO4_VERSION={version}-{revision} -f Build/Docker/Dockerfile .".format(version=get_version(), revision=get_sdk_revision())
ctx.run(command)