-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
10 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 |
---|---|---|
@@ -1,10 +1,26 @@ | ||
#!/bin/bash | ||
set -ex | ||
#!/usr/bin/env python3 | ||
from plumbum import FG, local | ||
|
||
# See http://label-schema.org/rc1/#build-time-labels | ||
time docker image build \ | ||
--build-arg VCS_REF="$GIT_SHA1" \ | ||
--build-arg BUILD_DATE="$(date --rfc-3339 ns)" \ | ||
--build-arg VERSION="$DOCKER_TAG" \ | ||
--tag "$IMAGE_NAME" \ | ||
. | ||
COMMIT = local.env.get("GIT_SHA1", local.env.get("TRAVIS_COMMIT", "")) | ||
IMAGE_NAME = local.env["IMAGE_NAME"] | ||
ROOT = local.path(__file__).up(2) | ||
VERSION = IMAGE_NAME.split(":")[1] | ||
|
||
# Shortcuts | ||
build = local["time"]["docker", "image", "build"] | ||
date = local["date"]["--rfc-3339", "ns"] | ||
tag = local["docker"]["image", "tag"] | ||
|
||
# Build base and onbuild images | ||
build[ | ||
"--tag", | ||
IMAGE_NAME, | ||
# See http://label-schema.org/rc1/#build-time-labels | ||
"--build-arg", | ||
"VCS_REF=%s" % COMMIT, | ||
"--build-arg", | ||
"BUILD_DATE=%s" % date().strip(), | ||
"--build-arg", | ||
"VERSION=%s" % VERSION, | ||
ROOT, | ||
] & FG |
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,21 @@ | ||
#!/usr/bin/env python3 | ||
from plumbum import FG, local | ||
from plumbum.cmd import docker # noqa pylint: disable=import-error | ||
|
||
IMAGE_NAME = local.env["IMAGE_NAME"] | ||
REPO = IMAGE_NAME.split(":")[0] | ||
|
||
# Log all locally available images; will help to pin images | ||
docker["image", "ls", "--digests", REPO] & FG | ||
|
||
# Login in Docker Hub | ||
docker( | ||
"login", | ||
"--username", | ||
local.env["DOCKER_HUB_USERNAME"], | ||
"--password", | ||
local.env["DOCKER_HUB_TOKEN"], | ||
) | ||
|
||
# Push built image | ||
docker["image", "push", IMAGE_NAME] & FG |
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 +1,2 @@ | ||
docker | ||
plumbum |