Skip to content

Commit

Permalink
We have support to build the image for branches and tags
Browse files Browse the repository at this point in the history
  • Loading branch information
potiuk committed Jan 20, 2019
1 parent f09b175 commit 6328eaf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ ENV DEBIAN_FRONTEND=noninteractive
# Increase the value to force renstalling of all apt-get dependencies
ENV FORCE_REINSTALL_APT_GET_DEPENDENCIES=1

ARG AIRFLOW_TAG

# If you build for different version it will invalidate the cache here and rebuild from scratch
# This is typically used in release versions
ENV AIRFLOW_TAG=${AIRFLOW_TAG:-"development"}

RUN echo "Airflow tag: ${AIRFLOW_TAG}"

# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand Down
19 changes: 19 additions & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set +x

# Pull the image for image currently built if it exists
docker pull ${IMAGE_NAME} || true

# Pull the image for latest build if it exists
docker pull ${DOCKER_REPO}:latest || true

if [[ ${CACHE_TAG} == "latest-clean" || ${CACHE_TAG} =~ "release.*" ]]; then
CACHE_SPEC="--no-cache"
else
CACHE_SPEC="--cache-from ${IMAGE_NAME} --cache-from ${DOCKER_REPO}:latest"
fi

# Build the image using cached versions if present - both the branch/tag version and latest build can be used
# as cache source - docker will choose appropriate cache based on hashes of the files changed
docker build --pull --build-arg AIRFLOW_TAG=${CACHE_TAG} -f ${DOCKERFILE_PATH} -t ${IMAGE_NAME} \
${CACHE_SPEC} .
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
try:
with io.open('README.md', encoding='utf-8') as f:
long_description = f.read()
except FileNotFoundError as e:
except FileNotFoundError:
long_description = ''


Expand Down

0 comments on commit 6328eaf

Please sign in to comment.