Skip to content

Commit

Permalink
Adding more vars
Browse files Browse the repository at this point in the history
  • Loading branch information
admiralAwkbar committed Sep 2, 2020
1 parent b012d72 commit 7570e84
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
19 changes: 15 additions & 4 deletions .automation/upload-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ GCR_IMAGE_REPO='' # Docker tag for the image when create
FOUND_IMAGE=0 # Flag for if the image has already been built
CONTAINER_URL='' # Final URL to upload

###########################################################
# Dynamic build variables to pass to container when built #
###########################################################
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') # Current build date EX> "2017-08-28T09:24:41Z"
BUILD_VERSION='' # Current version of the container being built

#########################
# Source Function Files #
#########################
Expand Down Expand Up @@ -190,9 +196,14 @@ ValidateInput() {
# Set the IMAGE_VERSION to the BRANCH_NAME #
############################################
IMAGE_VERSION="${BRANCH_NAME}"
BUILD_VERSION="${IMAGE_VERSION}"
info "Tag:[${IMAGE_VERSION}]"
else
info "Successfully found:${F[W]}[IMAGE_VERSION]${F[B]}, value:${F[W]}[${IMAGE_VERSION}]"
#########################
# Set the build version #
#########################
BUILD_VERSION="${IMAGE_VERSION}"
fi

##################################
Expand Down Expand Up @@ -292,7 +303,7 @@ BuildImage() {
###################
# Build the image #
###################
docker build --no-cache -t "${CONTAINER_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" . 2>&1
docker build --no-cache --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${CONTAINER_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" . 2>&1

#######################
# Load the error code #
Expand All @@ -315,7 +326,7 @@ BuildImage() {
########################################################
if [ ${UPDATE_MAJOR_TAG} -eq 1 ]; then
# Tag the image with the major tag as well
docker build -t "${CONTAINER_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1
docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${CONTAINER_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1

#######################
# Load the error code #
Expand Down Expand Up @@ -351,7 +362,7 @@ BuildImage() {
###################
# Build the image #
###################
docker build -t "${ADDITONAL_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" . 2>&1
docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${ADDITONAL_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" . 2>&1

#######################
# Load the error code #
Expand All @@ -376,7 +387,7 @@ BuildImage() {
###################
# Build the image #
###################
docker build -t "${ADDITONAL_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1
docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${ADDITONAL_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1

#######################
# Load the error code #
Expand Down
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ FROM assignuser/chktex-alpine:v0.1.0 as chktex
##################
FROM python:alpine

############################
# Get the build arguements #
############################
ARG BUILD_DATE
ARG BUILD_VERSION

#########################################
# Label the instance and set maintainer #
#########################################
Expand All @@ -32,13 +38,14 @@ LABEL com.github.actions.name="GitHub Super-Linter" \
com.github.actions.icon="code" \
com.github.actions.color="red" \
maintainer="GitHub DevOps <[email protected]>" \
org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.version=$BUILD_VERSION \
org.opencontainers.image.authors="GitHub DevOps <[email protected]>" \
org.opencontainers.image.url="https://github.com/github/super-linter" \
org.opencontainers.image.documentation="https://github.com/github/super-linter" \
org.opencontainers.image.vendor="GitHub" \
org.opencontainers.image.description="Lint your code base with GitHub Actions"


################################
# Set ARG values used in Build #
################################
Expand Down

0 comments on commit 7570e84

Please sign in to comment.