From 5ee59b1564ad4914d6feadc5f91de976e8cd496a Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 9 Jul 2018 15:41:30 +0200 Subject: [PATCH] docker: dockerfile cleanups * Use LABEL instead of the deprecated MAINTAINER * Use COPY instead of ADD. There's no difference in operation here, it's just that we don't need the extra magic that ADD provides and best practice is to use COPY in that case. * Fix the mkdir /opt/workdir line - it wasn't being run since it was a CMD not RUN, and thus was overridden by a later CMD directive. * Drop the CMD line to run celery - having more than one CMD directive does not work. We'll launch a separate container to run it instead. Signed-off-by: Paul Eggleton --- Dockerfile | 19 ++++++++----------- Dockerfile.web | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9bb251e..c5a15d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM buildpack-deps:latest -MAINTAINER Michael Halstead +LABEL maintainer="Michael Halstead " EXPOSE 80 ENV PYTHONUNBUFFERED 1 @@ -20,21 +20,18 @@ RUN apt-get install -y --no-install-recommends \ RUN pip install --upgrade pip RUN pip install gunicorn RUN pip install setuptools -CMD mkdir /opt/workdir -ADD . /opt/layerindex +RUN mkdir /opt/workdir +COPY . /opt/layerindex RUN pip install -r /opt/layerindex/requirements.txt -ADD settings.py /opt/layerindex/settings.py -ADD docker/updatelayers.sh /opt/updatelayers.sh -ADD docker/migrate.sh /opt/migrate.sh +COPY settings.py /opt/layerindex/settings.py +COPY docker/updatelayers.sh /opt/updatelayers.sh +COPY docker/migrate.sh /opt/migrate.sh ## Uncomment to add a .gitconfig file within container -#ADD docker/.gitconfig /root/.gitconfig +#COPY docker/.gitconfig /root/.gitconfig ## Uncomment to add a proxy script within container, if you choose to ## do so, you will also have to edit .gitconfig appropriately -#ADD docker/git-proxy /opt/bin/git-proxy +#COPY docker/git-proxy /opt/bin/git-proxy # Start Gunicorn CMD ["/usr/local/bin/gunicorn", "wsgi:application", "--workers=4", "--bind=:5000", "--log-level=debug", "--chdir=/opt/layerindex"] - -# Start Celery -CMD ["/usr/local/bin/celery", "-A", "layerindex.tasks", "worker", "--loglevel=info", "--workdir=/opt/layerindex"] diff --git a/Dockerfile.web b/Dockerfile.web index 0b9e2c2..e73974a 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -1,4 +1,4 @@ FROM nginx:latest -MAINTAINER Michael Halstead +LABEL maintainer="Michael Halstead " COPY docker/nginx.conf /etc/nginx/nginx.conf COPY layerindex/static /usr/share/nginx/html/static