From 694670af0fff447d6d7675e69379219363045fce Mon Sep 17 00:00:00 2001 From: pjvanthof Date: Sun, 17 Feb 2019 17:23:11 +0100 Subject: [PATCH 1/5] Added compile step for npm packages --- Dockerfile | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d52e7d456c4c3..a933460c0cf3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,26 +16,39 @@ FROM python:3.6-slim -COPY . /opt/airflow/ - ARG AIRFLOW_HOME=/usr/local/airflow ARG AIRFLOW_DEPS="all" ARG PYTHON_DEPS="" ARG buildDeps="freetds-dev libkrb5-dev libsasl2-dev libssl-dev libffi-dev libpq-dev git" -ARG APT_DEPS="$buildDeps libsasl2-dev freetds-bin build-essential default-libmysqlclient-dev apt-utils curl rsync netcat locales" +ARG APT_DEPS="libsasl2-dev freetds-bin build-essential default-libmysqlclient-dev apt-utils curl rsync netcat locales" + +ENV PATH="$HOME/.npm-packages/bin:$PATH" + +RUN if [ -n "${APT_DEPS}" ]; then apt install -y $APT_DEPS; fi \ + && apt autoremove -yqq --purge \ + && apt clean + +COPY . /opt/airflow/ WORKDIR /opt/airflow RUN set -x \ && apt update \ - && if [ -n "${APT_DEPS}" ]; then apt install -y $APT_DEPS; fi \ + && if [ -n "${buildDeps}" ]; then apt install -y $buildDeps; fi \ + && curl -sL https://deb.nodesource.com/setup_11.x | bash - \ + && apt install -y nodejs \ && if [ -n "${PYTHON_DEPS}" ]; then pip install --no-cache-dir ${PYTHON_DEPS}; fi \ + && pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir --no-use-pep517 -e .[$AIRFLOW_DEPS] \ && apt purge --auto-remove -yqq $buildDeps \ && apt autoremove -yqq --purge \ - && apt clean + && apt clean \ + && cd /opt/airflow/airflow/www \ + && npm install \ + && npm run prod WORKDIR $AIRFLOW_HOME RUN mkdir -p $AIRFLOW_HOME +ENV AIRFLOW_HOME=$AIRFLOW_HOME COPY scripts/docker/entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] CMD ["--help"] From 00fdc198f0c3081b2fd92d07fd6c3aa06b5574a4 Mon Sep 17 00:00:00 2001 From: pjvanthof Date: Sun, 17 Feb 2019 21:34:35 +0100 Subject: [PATCH 2/5] Remove duplicated library --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a933460c0cf3c..b91e0d5d86530 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ FROM python:3.6-slim ARG AIRFLOW_HOME=/usr/local/airflow ARG AIRFLOW_DEPS="all" ARG PYTHON_DEPS="" -ARG buildDeps="freetds-dev libkrb5-dev libsasl2-dev libssl-dev libffi-dev libpq-dev git" +ARG buildDeps="freetds-dev libkrb5-dev libssl-dev libffi-dev libpq-dev git" ARG APT_DEPS="libsasl2-dev freetds-bin build-essential default-libmysqlclient-dev apt-utils curl rsync netcat locales" ENV PATH="$HOME/.npm-packages/bin:$PATH" From a6b818442f1789dd28f343af424a467cb1febed5 Mon Sep 17 00:00:00 2001 From: pjvanthof Date: Thu, 21 Feb 2019 07:27:16 +0100 Subject: [PATCH 3/5] Move check outside if statement --- Dockerfile | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index b91e0d5d86530..906209bf803e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,27 +24,31 @@ ARG APT_DEPS="libsasl2-dev freetds-bin build-essential default-libmysqlclient-de ENV PATH="$HOME/.npm-packages/bin:$PATH" -RUN if [ -n "${APT_DEPS}" ]; then apt install -y $APT_DEPS; fi \ +RUN set -euxo pipefail \ + && apt update \ + && if [ -n "${APT_DEPS}" ]; then apt install -y $APT_DEPS; fi \ + && curl -sL https://deb.nodesource.com/setup_10.x | bash - \ + && apt update \ + && apt install -y nodejs \ && apt autoremove -yqq --purge \ && apt clean COPY . /opt/airflow/ +WORKDIR /opt/airflow/airflow/www +RUN npm install \ + && npm run prod + WORKDIR /opt/airflow -RUN set -x \ +RUN set -euxo pipefail \ && apt update \ && if [ -n "${buildDeps}" ]; then apt install -y $buildDeps; fi \ - && curl -sL https://deb.nodesource.com/setup_11.x | bash - \ - && apt install -y nodejs \ && if [ -n "${PYTHON_DEPS}" ]; then pip install --no-cache-dir ${PYTHON_DEPS}; fi \ - && pip install --no-cache-dir --upgrade pip \ + && pip install --no-cache-dir --upgrade pip==19.0.1 \ && pip install --no-cache-dir --no-use-pep517 -e .[$AIRFLOW_DEPS] \ && apt purge --auto-remove -yqq $buildDeps \ && apt autoremove -yqq --purge \ && apt clean \ - && cd /opt/airflow/airflow/www \ - && npm install \ - && npm run prod WORKDIR $AIRFLOW_HOME RUN mkdir -p $AIRFLOW_HOME From fc836b18bf39c18171369ce2c0144604753ae4e4 Mon Sep 17 00:00:00 2001 From: pjvanthof Date: Sun, 24 Feb 2019 20:47:26 +0100 Subject: [PATCH 4/5] Fixing some small comments --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 906209bf803e5..84860a6db11b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ FROM python:3.6-slim -ARG AIRFLOW_HOME=/usr/local/airflow +ENV AIRFLOW_HOME=/usr/local/airflow ARG AIRFLOW_DEPS="all" ARG PYTHON_DEPS="" ARG buildDeps="freetds-dev libkrb5-dev libssl-dev libffi-dev libpq-dev git" @@ -48,11 +48,10 @@ RUN set -euxo pipefail \ && pip install --no-cache-dir --no-use-pep517 -e .[$AIRFLOW_DEPS] \ && apt purge --auto-remove -yqq $buildDeps \ && apt autoremove -yqq --purge \ - && apt clean \ + && apt clean WORKDIR $AIRFLOW_HOME RUN mkdir -p $AIRFLOW_HOME -ENV AIRFLOW_HOME=$AIRFLOW_HOME COPY scripts/docker/entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] CMD ["--help"] From 4c55f58ba32f3798329bba0af973f356d1c84523 Mon Sep 17 00:00:00 2001 From: pjvanthof Date: Mon, 25 Feb 2019 10:41:20 +0100 Subject: [PATCH 5/5] Rename buildDeps --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 84860a6db11b8..1151264dc97f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ FROM python:3.6-slim ENV AIRFLOW_HOME=/usr/local/airflow ARG AIRFLOW_DEPS="all" ARG PYTHON_DEPS="" -ARG buildDeps="freetds-dev libkrb5-dev libssl-dev libffi-dev libpq-dev git" +ARG BUILD_DEPS="freetds-dev libkrb5-dev libssl-dev libffi-dev libpq-dev git" ARG APT_DEPS="libsasl2-dev freetds-bin build-essential default-libmysqlclient-dev apt-utils curl rsync netcat locales" ENV PATH="$HOME/.npm-packages/bin:$PATH" @@ -42,11 +42,11 @@ RUN npm install \ WORKDIR /opt/airflow RUN set -euxo pipefail \ && apt update \ - && if [ -n "${buildDeps}" ]; then apt install -y $buildDeps; fi \ + && if [ -n "${BUILD_DEPS}" ]; then apt install -y $BUILD_DEPS; fi \ && if [ -n "${PYTHON_DEPS}" ]; then pip install --no-cache-dir ${PYTHON_DEPS}; fi \ && pip install --no-cache-dir --upgrade pip==19.0.1 \ && pip install --no-cache-dir --no-use-pep517 -e .[$AIRFLOW_DEPS] \ - && apt purge --auto-remove -yqq $buildDeps \ + && apt purge --auto-remove -yqq $BUILD_DEPS \ && apt autoremove -yqq --purge \ && apt clean