mviereck / dockerfile-x11docker-deepin

3D desktop deepin from China
MIT License
33 stars 11 forks source link

Automate the deepin image building progress on Docker hub by writing a build hook script. #37

Closed hongyi-zhao closed 3 years ago

hongyi-zhao commented 3 years ago

I try to extend the Deepin apricot base image with the automated builds service supplied by docker hub using customized build envionment variable. The auto building service is linked to and based on the Dockerfile in my github repo here. For convenience, I use a customized environment variable to define the CODENAME of deepin as shown below:

image

But I noticed that the automated builds service failed with the building log as follows:

Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '140.82.114.3' to the list of known hosts.
Reset branch 'master'
Your branch is up-to-date with 'origin/master'.
KernelVersion: 4.4.0-1060-aws
Components: [{u'Version': u'19.03.8', u'Name': u'Engine', u'Details': {u'KernelVersion': u'4.4.0-1060-aws', u'Os': u'linux', u'BuildTime': u'2020-03-11T01:24:30.000000000+00:00', u'ApiVersion': u'1.40', u'MinAPIVersion': u'1.12', u'GitCommit': u'afacb8b7f0', u'Arch': u'amd64', u'Experimental': u'false', u'GoVersion': u'go1.12.17'}}, {u'Version': u'1.2.13', u'Name': u'containerd', u'Details': {u'GitCommit': u'7ad184331fa3e55e52b890ea95e65ba581ae3429'}}, {u'Version': u'1.0.0-rc10', u'Name': u'runc', u'Details': {u'GitCommit': u'dc9208a3303feef5b3839f4323d9beb36df0a9dd'}}, {u'Version': u'0.18.0', u'Name': u'docker-init', u'Details': {u'GitCommit': u'fec3683'}}]
Arch: amd64
BuildTime: 2020-03-11T01:24:30.000000000+00:00
ApiVersion: 1.40
Platform: {u'Name': u'Docker Engine - Community'}
Version: 19.03.8
MinAPIVersion: 1.12
GitCommit: afacb8b7f0
Os: linux
GoVersion: go1.12.17
Starting build of index.docker.io/hongyizhao/deepin-wine:apricot...
Step 1/6 : ARG CODENAME
Step 2/6 : FROM hongyizhao/deepin:${CODENAME}
invalid reference format

Any hints for fixing this problem?

Regards, HY

mviereck commented 3 years ago

Sorry, no idea. I did never use the ARG instruction. From what I can see, your setup looks right.

hongyi-zhao commented 3 years ago

It seems the environment variables set this way can't be picked by the docker hub autobuild service. Instead, the build hook script based method should be used for more advanced image build flow control. See the following websites/projects for more info on this subject:

https://github.com/andyneff/docker_hook_test
https://docs.docker.com/docker-hub/builds/advanced/
https://github.com/docker/hub-feedback/issues/508
https://github.com/docker/hub-feedback/issues/508#issuecomment-240397523
https://github.com/docker/hub-feedback/issues/508#issuecomment-240616319
https://dev.to/samuelea/automate-your-builds-on-docker-hub-by-writing-a-build-hook-script-13fp

And I finally do the trick with the build hook script written in bash. This method is powerful/wonderful and each commit will trigger the corresponding build process on Docker hub automatically.