potiuk commented on a change in pull request #4543: [AIRFLOW-3718] [WIP] 
Multi-layered version of the docker image
URL: https://github.com/apache/airflow/pull/4543#discussion_r262156770
 
 

 ##########
 File path: docker_build.sh
 ##########
 @@ -0,0 +1,46 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+# Echo you can override envronment variables to build images you want
+# PYTHON_VERSION [2.7, 3.5, 3.6] - you can choose which python version should 
be installed
+# DOCKERHUB_USER = defaults to airflow but you can override it to build images 
you want to
+#                  publish under different dockerhub user
+# PUSH_IMAGES = defaults to false - no images are pushed, but you can set it 
to true to push images to
+#               DockerHub. Useful when you use your own DOCKERHUB_USER and 
push images for caching for your
+#               organization
+set -euo pipefail
+
+set -x
+export PYTHON_VERSION=${PYTHON_VERSION:=$(python -c 'import sys; print("%s.%s" 
% (sys.version_info.major, sys.version_info.minor))')}
+export DOCKERHUB_USER=${DOCKERHUB_USER:=airflow}
+export IMAGE_NAME=${DOCKERHUB_USER}/airflow:latest-${PYTHON_VERSION}
+export PUSH_IMAGES=${PUSH_IMAGES:=false}
 
 Review comment:
   I dunderstand that, this is perfectly fine. What will eventually happen (if 
what I do will prove working well) is that DockerHub builds will auto-build and 
push the images from master only. Those images will be used by TravisCI as 
cache for builds (it will only eventually rebuild latest layer with sources 
locally + occasionally it will only install dependencies when they change. But 
this is something i am currently looking at to optimize a bit.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to