From 467a95135cac62a7d88a601f87108da5b722e631 Mon Sep 17 00:00:00 2001 From: Brad Ison Date: Mon, 7 May 2018 15:34:01 -0700 Subject: [PATCH] Combine base and main Dockerfile --- Dockerfile | 107 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 93 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 30504e666..ef4cf3ee1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,98 @@ # vim:ft=dockerfile -FROM quay.io/quay/quay-base:latest +FROM phusion/baseimage:0.10.0 + +ENV DEBIAN_FRONTEND noninteractive +ENV HOME /root +ENV QUAYDIR /quay-registry +ENV QUAYCONF /quay-registry/conf +ENV QUAYPATH "." + +RUN mkdir $QUAYDIR +WORKDIR $QUAYDIR + +# This is so we don't break http golang/go#17066 +# When Ubuntu has nginx >= 1.11.0 we can switch back. +RUN add-apt-repository ppa:nginx/development + +# Add Yarn repository until it is officially added to Ubuntu +RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list +RUN curl -fsSL https://deb.nodesource.com/setup_8.x | bash - +# Install system packages +RUN apt-get update && apt-get upgrade -y \ + && apt-get install -y \ + dnsmasq \ + g++ \ + gdb \ + gdebi-core \ + git \ + jpegoptim \ + libevent-2.0.5 \ + libevent-dev \ + libffi-dev \ + libfreetype6-dev \ + libgpgme11 \ + libgpgme11-dev \ + libjpeg62 \ + libjpeg62-dev \ + libjpeg8 \ + libldap-2.4-2 \ + libldap2-dev \ + libmagic1 \ + libpq-dev \ + libpq5 \ + libsasl2-dev \ + libsasl2-modules \ + memcached \ + monit \ + nginx \ + nodejs \ + optipng \ + openssl \ + python-dbg \ + python-dev \ + python-pip \ + python-virtualenv \ + yarn=0.22.0-1 \ + w3m # 27MAR2018 + +# Install cfssl +RUN curl -fsSL -o /bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 \ + && curl -fsSL -o /bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 \ + && chmod 0755 /bin/cfssl /bin/cfssljson + +# Install jwtproxy +RUN curl -fsSL -o /usr/local/bin/jwtproxy https://github.com/coreos/jwtproxy/releases/download/v0.0.1/jwtproxy-linux-x64 \ + && chmod +x /usr/local/bin/jwtproxy + +# Install prometheus-aggregator +RUN curl -fsSL -o /usr/local/bin/prometheus-aggregator https://github.com/coreos/prometheus-aggregator/releases/download/v0.0.1-alpha/prometheus-aggregator \ + && chmod +x /usr/local/bin/prometheus-aggregator + +# Install python dependencies +COPY requirements.txt requirements-tests.txt ./ +RUN virtualenv --distribute venv \ + && venv/bin/pip install -r requirements.txt \ + && venv/bin/pip install -r requirements-tests.txt \ + && venv/bin/pip freeze + +# Install front-end dependencies +COPY static/ package.json tsconfig.json webpack.config.js tslint.json yarn.lock ./ +RUN yarn install --ignore-engines + + +RUN mkdir -p /etc/my_init.d /etc/systlog-ng /usr/local/bin /etc/monit $QUAYDIR/static/fonts $QUAYDIR/static/ldn /usr/local/nginx/logs/ + +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.cache +VOLUME ["/var/log", "/datastorage", "/tmp"] + + RUN adduser memcached --disabled-login --system WORKDIR $QUAYDIR -COPY requirements.txt requirements-tests.txt ./ - # Check python dependencies for the GPL # Due to the following bug, pip results must be piped to a file before grepping: # https://github.com/pypa/pip/pull/3304 @@ -15,16 +100,6 @@ RUN cat requirements.txt | grep -v "^-e" | awk -F'==' '{print $1}' | xargs venv/ test -z "$(cat pipinfo.txt | grep GPL | grep -v LGPL)" && \ rm pipinfo.txt -RUN virtualenv --distribute venv \ - && venv/bin/pip install -r requirements.txt \ - && venv/bin/pip install -r requirements-tests.txt \ - && venv/bin/pip freeze - -# Install front-end dependencies -# JS dependencies -COPY yarn.lock package.json tsconfig.json webpack.config.js tslint.json ./ -RUN yarn install --ignore-engines - # JS compile COPY static static RUN yarn build \ @@ -33,8 +108,10 @@ RUN yarn build \ COPY . . +RUN PYTHONPATH=$QUAYPATH venv/bin/python -m external_libraries + # Update local copy of AWS IP Ranges. -RUN curl https://ip-ranges.amazonaws.com/ip-ranges.json -o util/ipresolver/aws-ip-ranges.json +RUN curl -fsSL https://ip-ranges.amazonaws.com/ip-ranges.json -o util/ipresolver/aws-ip-ranges.json # Set up the init system RUN mkdir -p /etc/my_init.d /etc/systlog-ng /usr/local/bin /etc/monit static/fonts static/ldn /usr/local/nginx/logs/ \ @@ -59,4 +136,6 @@ RUN PYTHONPATH=$QUAYPATH venv/bin/alembic heads | grep -E '^[0-9a-f]+ \(head\)$' RUN ./scripts/detect-config.sh +EXPOSE 443 8443 80 + CMD ./quay-entrypoint.sh