Building Docker Images
Building and pushing images to Dockerhub with Concourse CI. The two pipelines that follow contain a single job that builds and pushes them to dockerhub.
oci-build-task
- The new-school way
resources:- name: code-repotype: gitsource:branch: mainprivate_key: ((repo_key))uri: git@gitlab.com:oozie/dockerfiles.gitpaths: [ oozie/python/3.9 ]- name: oozie_pythontype: registry-imagesource:repository: oozie/pythontag: 3.9username: ((docker_user))password: ((docker_password))jobs:- name: publish-imageplan:- get: code-repotrigger: true- task: buildprivileged: trueconfig:platform: linuximage_resource:type: registry-imagesource:repository: concourse/oci-build-taskinputs:- name: code-repooutputs:- name: imageparams:DOCKERFILE: code-repo/oozie/python/3.9/Dockerfilerun:path: build- put: oozie_pythonparams:image: image/image.tar
docker-image
- The legacy way
code-repo
- git repo containing the docker filemy-docker-image
- definition of docker repo name and tag with credentials for pushing
resources:- name: code-repotype: gitsource:branch: mainprivate_key: ((repo_key))uri: ((repo_uri)) # e.g. git@github.com:mycompany/dockerfiles.git- name: my-docker-imagetype: docker-imagesource:repository: mycompany/myimagetag: myimagetagusername: ((my-dockerhub-username))password: ((my-dockerhub-password))jobs:- name: publish-imageplan:- get: code-repo- put: my-docker-imageparams:build: code-repo # path to the directory with a Dockerfile.# The example assumes Dockerfile lives# in the root of the repo.